ci: drop destructive npm self-upgrade in publish workflow
What
Removes the Update npm for OIDC support step (npm install -g npm@latest) from both the publish-packages and publish-single jobs in .github/workflows/publish-npm.yml.
Why
Follow-up to #246 (which bumped the pinned Node to 22.22.3). With the npm-upgrade step now able to run, the next publish failed at the actual publish step:
npm error code MODULE_NOT_FOUND
npm error Cannot find module 'sigstore'
npm error - .../npm/node_modules/libnpmpublish/lib/provenance.js
Root cause: npm install -g npm@latest self-upgrades npm over its own bundled copy and prunes packages it still needs ā the log shows removed 71 packages, and changed 85 packages. The resulting npm can no longer require('sigstore') during npm publish --provenance. This is the known destructive-self-upgrade behavior (npm/cli#2736, npm/cli#3175), and the same corruption class that produced the earlier promise-retry failure.
Fix
Drop the self-upgrade step entirely and use the npm bundled with Node 22.22.3 (npm 10.9.8). The step was never required for this workflow:
- The workflow already grants
id-token: write(line 59) and publishes with--provenance. - Provenance / OIDC id-token attestation has been supported since npm 9.5, so 10.9.8 is sufficient.
- Pinning a specific
npm@xversion wouldn't help ā it still self-upgrades over the bundled npm and can corrupt the tree the same way.
Removing the step eliminates the entire self-install corruption class (promise-retry, sigstore) and the npm@latest moving-target engine breakage.
Note: this workflow is workflow_dispatch-only and its dry_run path uses npm publish --dry-run without --provenance, so a dry run won't exercise the provenance code path ā only a real publish fully validates it. The fix is sound by construction (the bundled npm's libnpmpublish ships an intact sigstore), but a real publish is the definitive confirmation.
š¤ Generated with Claude Code
Generated by Claude Code