fix(ci): upgrade npm to 11.5.1+ for OIDC trusted publishing#87
Merged
Conversation
Node 22 ships with npm 10.x, which does not know how to exchange the GitHub OIDC id-token for a short-lived npm token. Without this upgrade, the publish step silently falls back to the empty NODE_AUTH_TOKEN that setup-node writes to .npmrc, and the registry returns 404. First test publish (v0.7.4-rc.0) failed at exactly this point, even though provenance signing via sigstore succeeded, confirming the OIDC handshake with GitHub was fine and only the npm-side auth was broken. Fix: `npm install -g npm@latest` before the publish step. Adds ~5s to runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First OIDC test publish (
v0.7.4-rc.0) failed with npm error 404 on the publish PUT request, even though sigstore provenance signing succeeded. Root cause: Node 22 ships with npm 10.x, which does not support exchanging the GitHub OIDC id-token for a short-lived npm token. The publish step silently fell back to the emptyNODE_AUTH_TOKENwritten bysetup-node.Fix: one new step that runs
npm install -g npm@latestaftersetup-nodeand beforenpm publish. Bumps to npm 11+, which knows how to use OIDC trusted publishing.Test plan
0.7.4-rc.1