From df2010dfacec705b36e38017d2dbeea6620f86bf Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Wed, 13 May 2026 00:19:41 +0400 Subject: [PATCH] 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) --- .github/workflows/package-release.yaml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/package-release.yaml b/.github/workflows/package-release.yaml index 1ebbc90..db42e4c 100644 --- a/.github/workflows/package-release.yaml +++ b/.github/workflows/package-release.yaml @@ -65,27 +65,24 @@ jobs: echo "old=$OLD" >> $GITHUB_OUTPUT echo "new=$NEW" >> $GITHUB_OUTPUT if [ "$OLD" = "$NEW" ]; then echo "changed=false" >> $GITHUB_OUTPUT; else echo "changed=true" >> $GITHUB_OUTPUT; fi - # NPM version bump + tag (no push yet — batch with cargo) + # Cargo first — cargo-release refuses to run if the working tree is + # dirty, and it makes its own commit. + - name: Bump Cargo version + if: ${{ steps.cargo.outputs.changed == 'true' }} + run: | + nix develop -c cargo release --no-confirm --execute --no-tag --no-push -p rain-math-float alpha + echo "CARGO_VERSION=v$(cargo pkgid -p rain-math-float | cut -d@ -f2)" >> $GITHUB_ENV + # NPM second — npm version edits files but doesn't commit. - name: Bump NPM version if: ${{ steps.npm.outputs.changed == 'true' }} run: | NEW=$(npm version prerelease --preid alpha --no-git-tag-version) echo "NPM_VERSION=$NEW" >> $GITHUB_ENV git add package.json package-lock.json - # Cargo version bump + tag (no push yet — batch with npm) - - name: Bump Cargo version - if: ${{ steps.cargo.outputs.changed == 'true' }} - run: | - nix develop -c cargo release --no-confirm --execute --no-tag --no-push -p rain-math-float alpha - echo "CARGO_VERSION=v$(cargo pkgid -p rain-math-float | cut -d@ -f2)" >> $GITHUB_ENV - # Single push of both bump commits (cargo-release made its own commit; - # the npm bump is staged into a separate commit here). - - name: Commit and push version bumps + git commit -m "Package Release npm-${NEW}" + - name: Tag and push if: ${{ steps.npm.outputs.changed == 'true' || steps.cargo.outputs.changed == 'true' }} run: | - if [ "${{ steps.npm.outputs.changed }}" = "true" ]; then - git commit -m "Package Release npm-${{ env.NPM_VERSION }}" - fi if [ -n "${{ env.NPM_VERSION }}" ]; then git tag npm-${{ env.NPM_VERSION }}; fi if [ -n "${{ env.CARGO_VERSION }}" ]; then git tag crate-${{ env.CARGO_VERSION }}; fi git push origin main