-
Notifications
You must be signed in to change notification settings - Fork 0
ci: switch to npm trusted publishing (OIDC) #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
npm oidc trusted publishing GitHub Actions 2025💡 Result:
npm OIDC “Trusted Publishing” for GitHub Actions (status + setup, as of 2025)
permissions: id-token: write(and typicallycontents: read). [1], [3]--provenance). [2]Setup (high level)
This
id-token: writepermission is required for GitHub to mint the OIDC JWT your job will use. [3], [1]Sources: npm docs on trusted publishers [1], GitHub changelog announcement (GA, provenance defaults) [2], GitHub Actions OIDC permissions docs [3].
🌐 Web query:
setup-node registry-url oidc authentication💡 Result:
To use OIDC authentication with
actions/setup-node(i.e., publish to npm withoutNODE_AUTH_TOKEN), you need npm “Trusted Publishing” plus the GitHub OIDC token permission.1) Configure npm “Trusted Publisher”
In npmjs.com → your package → Settings → Trusted Publisher → GitHub Actions, register:
2) GitHub Actions workflow (OIDC publish)
Key points:
permissions: id-token: writeis the critical requirement for OIDC. (docs.npmjs.com)setup-node’sregistry-urlconfigures the registry and expects auth viaNODE_AUTH_TOKENfor classic token flows, but with Trusted Publishing, npm can authenticate the publish via OIDC (no secret needed). (github.com)3) When you still need
NODE_AUTH_TOKENIf your workflow must install private npm dependencies, you still need a (read-only) token for
npm ci; OIDC is “publish-only”. (docs.npmjs.com)Note (semantic-release)
If you publish via semantic-release, their docs warn that setting
registry-urlinsetup-nodecan conflict with semantic-release’s auth handling (they recommend omitting it). (semantic-release.gitbook.io)Citations:
🌐 Web query:
npm cli oidc trusted publishing NODE_AUTH_TOKEN required💡 Result:
With npm Trusted Publishing (OIDC),
NODE_AUTH_TOKENis not required fornpm publish.id-token: writeso GitHub can mint the OIDC token. [1]NODE_AUTH_TOKENis needed: if your workflow must install private npm dependencies (e.g., duringnpm ci), you still need traditional auth for install, and npm recommends a read-only token viaNODE_AUTH_TOKENfor that step. [1]actions/setup-node) useNODE_AUTH_TOKENbecause they’re writing an.npmrcthat references it—this is the classic/granular token path, not OIDC. [2]If you’re seeing an error like “
NODE_AUTH_TOKENrequired” during publish, the usual causes are: you’re not on npm ≥ 11.5.1, you haven’t configured the package’s Trusted Publisher on npm, or your CI isn’t providing OIDC (id-token: write). [1]Sources: npm Trusted Publishing docs [1]; GitHub “Publishing Node.js packages” docs (token-based
.npmrc/NODE_AUTH_TOKEN) [2].🏁 Script executed:
cat -n .github/workflows/deploy-snap.yml | head -80Repository: genlayerlabs/genlayer-wallet
Length of output: 2855
🏁 Script executed:
grep -A 10 "permissions:" .github/workflows/deploy-snap.ymlRepository: genlayerlabs/genlayer-wallet
Length of output: 290
🌐 Web query:
Node.js 20 npm version bundled included💡 Result:
Node.js 20 bundles npm, but the exact npm version depends on the specific Node 20 release:
To confirm on your machine:
npm -v(ornode -p "process.versions.npm").🌐 Web query:
Node.js version npm 11.5.1 bundled which version💡 Result:
npm11.5.1 is bundled with Node.js v24.5.0. [1]Sources: Node.js download archive for v24.5.0 (shows “npm version v11.5.1”). [1]
[1] (nodejs.org)
Citations:
Node 20's npm version (v10.8.2) does not support OIDC trusted publishing—either add
NODE_AUTH_TOKENor upgrade to Node 24+.npm OIDC trusted publishing (now GA) requires npm v11.5.1+, which is only bundled with Node.js v24.5.0 and later. The workflow uses Node 20, which bundles npm v10.8.2 (below the required version). This will cause authentication to fail during
npm publish.To fix: either set
NODE_AUTH_TOKEN(via a GitHub secret) for traditional token-based authentication, or upgradenode-versionto 24 or later.🤖 Prompt for AI Agents