diff --git a/.github/workflows/release-cross-platform.yml b/.github/workflows/release-cross-platform.yml index 46f0504b..7a82027d 100644 --- a/.github/workflows/release-cross-platform.yml +++ b/.github/workflows/release-cross-platform.yml @@ -168,6 +168,12 @@ jobs: } EOF (cd archives && sha256sum * > SHA256SUMS && cat SHA256SUMS) + - name: Stage the checked tarball on npm for the maintainer to approve + # The `./` makes npm read a file path. Without it, npm reads + # `npm-tarball/` as a GitHub repository and refuses to fetch it. + run: npm stage publish "./npm-tarball/$(node -p "require('./npm-tarball/pack-summary.json').tarball")" + # Tag only after the package is staged. A failed staging then leaves no + # tag, so a fixed workflow can release the same version from a new commit. - name: Tag the tested commit if: github.ref_type != 'tag' env: @@ -200,8 +206,6 @@ jobs: echo "::error::$TAG already names commit $existing." exit 1 fi - - name: Stage the checked tarball on npm for the maintainer to approve - run: npm stage publish "npm-tarball/$(node -p "require('./npm-tarball/pack-summary.json').tarball")" - name: Publish the checked archives as the GitHub release env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c6024052..3506b721 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -229,6 +229,28 @@ jobs: path: npm-tarball if-no-files-found: error + # The release stages this tarball with `npm stage publish` (D251). This job + # runs the same command with `--dry-run`, with the same Node and npm, so a + # command that cannot read the file fails here, before a release tags anything. + # Keep the command the same as the staging step in release-cross-platform.yml. + # This job holds no npm credential and sends nothing to npm. + npm-stage-dry-run: + name: npm stage (dry run) + needs: npm-pack + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 24 + - name: Use the npm the release uses + run: npm install -g npm@12 && npm --version + - uses: actions/download-artifact@v4 + with: + name: npm-tarball + path: npm-tarball + - name: Stage the checked tarball without sending it + run: npm stage publish --dry-run "./npm-tarball/$(node -p "require('./npm-tarball/pack-summary.json').tarball")" + # Each system installs the same packed tarball into an empty folder. Only the # smoke scripts are checked out; the source tree and build tools stay out of reach. npm-smoke: