|
72 | 72 |
|
73 | 73 | steps: |
74 | 74 | - 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 }} |
75 | 80 |
|
76 | 81 | - name: Set zig suffix for cache key |
77 | 82 | if: matrix.use-zigbuild |
@@ -405,7 +410,10 @@ jobs: |
405 | 410 |
|
406 | 411 | steps: |
407 | 412 | - 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 | + |
409 | 417 | - name: Setup Node.js |
410 | 418 | uses: actions/setup-node@v4 |
411 | 419 | with: |
@@ -525,11 +533,17 @@ jobs: |
525 | 533 | id: pkg |
526 | 534 | run: | |
527 | 535 | 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 |
529 | 544 | echo "name=$NAME" >> $GITHUB_OUTPUT |
530 | 545 | echo "version=$VER" >> $GITHUB_OUTPUT |
531 | | - echo "Package: $NAME" |
532 | | - echo "Version: $VER" |
| 546 | + echo "Package: $NAME@$VER" |
533 | 547 |
|
534 | 548 | - name: Check if version already published |
535 | 549 | id: check |
|
0 commit comments