|
73 | 73 | - name: Bump version and tag commit |
74 | 74 | if: ${{ inputs.skip_commit != 'true' }} |
75 | 75 | run: | |
76 | | - # Run cargo-workspaces publish with version bump, but don't push yet. |
77 | | - # This will bump versions, update Cargo.toml and dependencies, commit, and tag locally. |
78 | | - # Allow running on 'main' branch |
79 | | - # Commit and tag locally, but don't push yet (we'll push manually to handle conflicts) |
80 | | - cargo workspaces publish ${{ inputs.release_type }} \ |
| 76 | + # Run version bump for the workspace. |
| 77 | + # With publish = false set for subcrates, only the main crate will be published. |
| 78 | + cargo workspaces version ${{ inputs.release_type }} \ |
81 | 79 | --yes --allow-branch main \ |
82 | 80 | --no-git-push \ |
83 | 81 | ${{ inputs.dry_run == 'true' && '--dry-run' || '' }} |
@@ -124,7 +122,66 @@ jobs: |
124 | 122 | NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt |
125 | 123 | run: | |
126 | 124 | # Use --from-git to publish based on existing tags (skip versioning step) |
127 | | - cargo workspaces publish --from-git --yes \ |
| 125 | + # With publish = false set for subcrates, only the main crate will be published. |
| 126 | + cargo workspaces publish \ |
| 127 | + --from-git \ |
| 128 | + --yes \ |
128 | 129 | --allow-branch main \ |
129 | 130 | --token "${{ secrets.CRATES_IO_TOKEN }}" \ |
| 131 | + --no-verify \ |
130 | 132 | ${{ inputs.dry_run == 'true' && '--dry-run' || '' }} |
| 133 | +
|
| 134 | + # ALTERNATIVE APPROACH - Using standard cargo commands |
| 135 | + # Uncomment this section and comment out the cargo-workspaces approach if needed |
| 136 | + # |
| 137 | + # # 6. Alternative: Version bump with standard cargo |
| 138 | + # - name: Bump version and tag commit (standard cargo) |
| 139 | + # if: ${{ inputs.skip_commit != 'true' }} |
| 140 | + # run: | |
| 141 | + # # Update version in the main crate's Cargo.toml |
| 142 | + # # Assuming the main crate is at the workspace root |
| 143 | + # |
| 144 | + # # Extract current version |
| 145 | + # CURRENT_VERSION=$(grep -m 1 'version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/') |
| 146 | + # echo "Current version: $CURRENT_VERSION" |
| 147 | + # |
| 148 | + # # Calculate new version based on semver bump level |
| 149 | + # if [[ "${{ inputs.release_type }}" == "patch" ]]; then |
| 150 | + # NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$NF = $NF + 1;} 1' OFS=.) |
| 151 | + # elif [[ "${{ inputs.release_type }}" == "minor" ]]; then |
| 152 | + # NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$(NF-1) = $(NF-1) + 1; $NF = 0;} 1' OFS=.) |
| 153 | + # elif [[ "${{ inputs.release_type }}" == "major" ]]; then |
| 154 | + # NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$1 = $1 + 1; $(NF-1) = 0; $NF = 0;} 1' OFS=.) |
| 155 | + # fi |
| 156 | + # echo "New version: $NEW_VERSION" |
| 157 | + # |
| 158 | + # # Update version in Cargo.toml |
| 159 | + # sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml |
| 160 | + # |
| 161 | + # # Commit the version change |
| 162 | + # git add Cargo.toml |
| 163 | + # git commit -m "Release v$NEW_VERSION" |
| 164 | + # |
| 165 | + # # Add tag |
| 166 | + # git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION" |
| 167 | + # env: |
| 168 | + # # Fix SSL certificate issues |
| 169 | + # NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt |
| 170 | + # # Use token for authentication |
| 171 | + # CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
| 172 | + # |
| 173 | + # # 9. Alternative: Publish with standard cargo |
| 174 | + # - name: Publish main crate (standard cargo) |
| 175 | + # if: ${{ inputs.dry_run != 'true' }} |
| 176 | + # run: | |
| 177 | + # # Publish only the main crate |
| 178 | + # # If dry_run is true, use --dry-run flag |
| 179 | + # if [[ "${{ inputs.dry_run }}" == "true" ]]; then |
| 180 | + # cargo publish --dry-run |
| 181 | + # else |
| 182 | + # cargo publish |
| 183 | + # fi |
| 184 | + # env: |
| 185 | + # CARGO_REGISTRIES_CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
| 186 | + # CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
| 187 | + # NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt |
0 commit comments