fix: use npm OIDC trusted publishing instead of token auth#6
Merged
Conversation
actions/setup-node creates the .npmrc referencing NODE_AUTH_TOKEN but does not provide the token value itself. The --provenance flag uses OIDC for attestation signing only, not for registry authentication. Without a valid token, npm publish returns 404 on the scoped package. Requires an NPM_TOKEN repo secret with a granular access token that has publish permission to the @jim80net scope. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
GitHub-hosted runners ship npm 10.9.4 (with Node 22) which lacks OIDC trusted publishing support. npm >= 11.5.1 is required for OIDC token exchange, especially for scoped packages (npm/cli#8678). Changes: - Upgrade npm to latest before publish (for OIDC support) - Remove NPM_TOKEN secret — OIDC handles authentication - Remove --provenance flag — automatic with trusted publishing Requires configuring the trusted publisher on npmjs.com: Package Settings > Trusted Publishers > Add GitHub Actions (org: jim80net, repo: memex-core, workflow: release-please.yml, environment: npm) Co-Authored-By: Claude Opus 4.6 (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
NPM_TOKENsecret — OIDC handles authentication viaid-token: write--provenanceflag — automatic with trusted publishingProblem
npm publishfailed with E404 because the runner's npm (10.9.4) doesn't support OIDC trusted publishing. It fell back toNODE_AUTH_TOKENwhich was a placeholder, not a real npm token.npm trusted publishing (GA since July 2025) eliminates the need for long-lived npm tokens entirely. The npm CLI exchanges a GitHub OIDC token for a short-lived publish token, but this requires npm >= 11.5.1 — especially for scoped packages (npm/cli#8678).
Setup required on npmjs.com
Go to the @jim80net/memex-core package settings > Trusted Publishers > Add GitHub Actions:
Test plan
References
🤖 Generated with Claude Code