ci: install npm@latest in publish jobs for OIDC Trusted Publishing#18
Merged
Conversation
Node 22 ships with npm 10.x; npm Trusted Publishing's OIDC auto-detection lives in npm 11.5.1+. Without it, `npm publish` falls back to the actions/setup-node placeholder auth in ~/.npmrc and gets 404'd by the registry on upload (npm's opaque way of saying "no auth"). Bump npm to latest right before publish in both release jobs. Cheap (one network install) and keeps the rest of the pipeline on the runner's stable Node 22 toolchain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The first nightly publish from #17 failed with
404 PUT /cli-bridge— npm's opaque "no valid auth" response. Diagnosis from the run log:actions/setup-nodeinjected its placeholder_authToken=${NODE_AUTH_TOKEN}npmrc, but no real token was provided (we're going OIDC-only) and the npm CLI shipped with Node 22 (10.x) is too old to auto-detect OIDC.Trusted Publishing OIDC auto-detection lives in npm 11.5.1+. Bundled npm with Node 22 is 10.x, falls back to the registry-url placeholder auth, and gets 404'd.
Fix:
npm install -g npm@latestimmediately beforenpm publishin both release jobs. Cheap (single global install, ~1s), keeps the rest of the toolchain on the runner's stable Node 22 default, and is forward-compatible with future npm releases.Provenance, dist-tag derivation, version stamping, and concurrency control all stayed correct in the failed run — only the upload auth was missing. Re-running with the bump should publish cleanly.
Test plan
cli-bridge@0.1.2-nightly.<date>.<sha>to land on npm withdist-tag=nightly.lateststays at0.1.2.NPM_TOKENrepo secret (no longer used).🤖 Generated with Claude Code