[CI/CD] switch npm publishing to trusted publishing (OIDC) - #28
Merged
Conversation
- Grant the job id-token: write (plus contents: read for the tag guard and release-asset download); npm publish exchanges the GitHub OIDC token for a short-lived per-publish credential and generates provenance attestations automatically. - Drop registry-url from setup-node: it writes an .npmrc authToken line referencing $NODE_AUTH_TOKEN, and npm hard-fails on every command when a referenced env var is unset. - Bump to Node 24 (Node 20 is EOL) and pin npm@12.0.1 alongside the existing semver pin — trusted publishing requires npm >= 11.5.1 and the runner's bundled npm may lag. - Remove NODE_AUTH_TOKEN from the publish step; no registry token is referenced anywhere anymore.
This was referenced Jul 29, 2026
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.
Motivation
Final step of the trusted-publishing migration (#26, #27): npm publishing no longer uses a registry token. The job mints a GitHub OIDC token that npm verifies against each package's trusted publisher config (org
ProvableHQ, repoaleo-devnode, workflownpm-publish.yml— already configured on all six packages), exchanges it for a short-lived per-publish credential, and generates provenance attestations automatically.Changes to
npm-publish.yml:permissions: id-token: write(pluscontents: readfor the tag guard and release-asset download).registry-urlremoved fromsetup-node: it writes an.npmrcauthToken line referencing$NODE_AUTH_TOKEN, and npm hard-fails on every command when a referenced env var is unset — with the token gone, keeping it would break the workflow outright.npm@12.0.1pinned alongside the existingsemverpin: trusted publishing requires npm ≥ 11.5.1 and the runner's bundled npm may lag. Exact pins for the same supply-chain reason as consolidate npm publishing for trusted publishing (OIDC) #26's semver pin.NODE_AUTH_TOKENremoved from the publish step. No token is referenced anywhere in the workflows anymore.The six packages already disallow token publishing (npmjs.com publishing-access setting), so after this merges the
NPM_TOKENrepo secret is dead weight: the remaining cleanup is revoking the granular token on npmjs.com and deleting the secret.Rollback path if the first OIDC publish fails: revert this PR, re-enable token publishing on the packages, and restore a valid
NPM_TOKEN.Test Plan
NPM_TOKEN/NODE_AUTH_TOKEN/registry-urlreferences remain in either workflow.Related PRs