Skip to content

Commit 15c9a2c

Browse files
committed
fix(ci): checkout correct version tag for build and publish
The build and publish jobs were checking out the default ref (pre-bump), causing them to build and publish the OLD version instead of the NEW one. Changes: 1. Build jobs: checkout v${{ inputs.version }} tag (created by version job) 2. Publish job: same checkout ref as build jobs 3. Publish job: use inputs.version for npm version check This ensures: - Build compiles the correct version code - npm publish publishes the correct version
1 parent 5a62207 commit 15c9a2c

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/build-all-platforms.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ jobs:
7272

7373
steps:
7474
- uses: actions/checkout@v4
75+
with:
76+
# For workflow_call: checkout the version tag created by release.yml
77+
# For tag push: checkout the pushed tag (github.ref)
78+
# For workflow_dispatch: checkout the specified tag or default branch
79+
ref: ${{ inputs.version && format('v{0}', inputs.version) || github.ref }}
7580

7681
- name: Set zig suffix for cache key
7782
if: matrix.use-zigbuild
@@ -405,7 +410,10 @@ jobs:
405410

406411
steps:
407412
- uses: actions/checkout@v4
408-
413+
with:
414+
# Checkout the correct version tag (same as build jobs)
415+
ref: ${{ inputs.version && format('v{0}', inputs.version) || github.ref }}
416+
409417
- name: Setup Node.js
410418
uses: actions/setup-node@v4
411419
with:
@@ -525,11 +533,17 @@ jobs:
525533
id: pkg
526534
run: |
527535
NAME=$(node -e "console.log(require('./npx-cli/package.json').name)")
528-
VER=$(node -e "console.log(require('./npx-cli/package.json').version)")
536+
# Use inputs.version if available (from workflow_call), otherwise read from package.json
537+
if [[ -n "${{ inputs.version }}" ]]; then
538+
VER="${{ inputs.version }}"
539+
echo "Using version from workflow input: $VER"
540+
else
541+
VER=$(node -e "console.log(require('./npx-cli/package.json').version)")
542+
echo "Using version from package.json: $VER"
543+
fi
529544
echo "name=$NAME" >> $GITHUB_OUTPUT
530545
echo "version=$VER" >> $GITHUB_OUTPUT
531-
echo "Package: $NAME"
532-
echo "Version: $VER"
546+
echo "Package: $NAME@$VER"
533547
534548
- name: Check if version already published
535549
id: check

0 commit comments

Comments
 (0)