Skip to content

Commit df2010d

Browse files
fix(ci): bump cargo before npm in package-release
cargo-release refuses to run if the working tree is dirty. The npm bump step was running first, staging package.json+package-lock.json, then cargo-release errored with 'uncommitted changes detected'. Run cargo first (it makes its own commit), then npm (which now commits itself before the tag step). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 60b81fe commit df2010d

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

.github/workflows/package-release.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,24 @@ jobs:
6565
echo "old=$OLD" >> $GITHUB_OUTPUT
6666
echo "new=$NEW" >> $GITHUB_OUTPUT
6767
if [ "$OLD" = "$NEW" ]; then echo "changed=false" >> $GITHUB_OUTPUT; else echo "changed=true" >> $GITHUB_OUTPUT; fi
68-
# NPM version bump + tag (no push yet — batch with cargo)
68+
# Cargo first — cargo-release refuses to run if the working tree is
69+
# dirty, and it makes its own commit.
70+
- name: Bump Cargo version
71+
if: ${{ steps.cargo.outputs.changed == 'true' }}
72+
run: |
73+
nix develop -c cargo release --no-confirm --execute --no-tag --no-push -p rain-math-float alpha
74+
echo "CARGO_VERSION=v$(cargo pkgid -p rain-math-float | cut -d@ -f2)" >> $GITHUB_ENV
75+
# NPM second — npm version edits files but doesn't commit.
6976
- name: Bump NPM version
7077
if: ${{ steps.npm.outputs.changed == 'true' }}
7178
run: |
7279
NEW=$(npm version prerelease --preid alpha --no-git-tag-version)
7380
echo "NPM_VERSION=$NEW" >> $GITHUB_ENV
7481
git add package.json package-lock.json
75-
# Cargo version bump + tag (no push yet — batch with npm)
76-
- name: Bump Cargo version
77-
if: ${{ steps.cargo.outputs.changed == 'true' }}
78-
run: |
79-
nix develop -c cargo release --no-confirm --execute --no-tag --no-push -p rain-math-float alpha
80-
echo "CARGO_VERSION=v$(cargo pkgid -p rain-math-float | cut -d@ -f2)" >> $GITHUB_ENV
81-
# Single push of both bump commits (cargo-release made its own commit;
82-
# the npm bump is staged into a separate commit here).
83-
- name: Commit and push version bumps
82+
git commit -m "Package Release npm-${NEW}"
83+
- name: Tag and push
8484
if: ${{ steps.npm.outputs.changed == 'true' || steps.cargo.outputs.changed == 'true' }}
8585
run: |
86-
if [ "${{ steps.npm.outputs.changed }}" = "true" ]; then
87-
git commit -m "Package Release npm-${{ env.NPM_VERSION }}"
88-
fi
8986
if [ -n "${{ env.NPM_VERSION }}" ]; then git tag npm-${{ env.NPM_VERSION }}; fi
9087
if [ -n "${{ env.CARGO_VERSION }}" ]; then git tag crate-${{ env.CARGO_VERSION }}; fi
9188
git push origin main

0 commit comments

Comments
 (0)