Repository navigation
ci: publish through npm trusted publishing (OIDC) instead of NPM_TOKEN - #40
Merged
Merged
Conversation
npm is removing direct publish from tokens that bypass 2FA (target January 2027). The release job now gets id-token: write and npm 11, drops the npm token and registry-url, and lets changesets/action v1.9's OIDC path publish; every version gains a provenance statement. A patch changeset republishes all 21 packages so each new trusted-publisher configuration is used within npm's 2-day window, and scripts/trust-publishers.sh registers release.yml as the trusted publisher of every public package.
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.
This moves releases from the
NPM_TOKENsecret to npm trusted publishing (OIDC). npm is removing direct publish from tokens that bypass 2FA, with January 2027 as the target date. Our CI token is that kind of token, so releases would stop working then.Change
release.ymlid-token: writeto the job.npm info --jsonas an object, and npm 12 returns an array.registry-urland both token env vars. Any_authTokenin an.npmrcmakes npm skip OIDC.NPM_TOKEN,changesets/actionv1.9 leaves~/.npmrcuntouched and logs "using npm trusted publishing".changeset publish→pnpm publish→npm publishthen exchanges the job's OIDC token. This path is known to work on pnpm 10 (pnpm v11: spawned npm publish no longer reaches npm OIDC trusted publishing pnpm/pnpm#11566). Node stays at 22, matching CI.scripts/trust-publishers.sh. It registersrefkitjs/refkit+release.ymlas the trusted publisher of every public package, usingnpm trust github … --allow-publish. Run it once now, and again for any future package after its first manual publish.Rollout, in this order
npm login, thenbash scripts/trust-publishers.sh. On the first 2FA prompt, tick "skip 2FA for 5 minutes" so all 21 go through.NPM_TOKENrepository secret;If step 3 fails,
NPM_TOKENis still there, so restoring the old workflow lines is a one-commit rollback.Not in this PR
The official changesets flow for trusted publishing (changesets/action v2) splits pack and publish into separate jobs, so only the publish job holds the OIDC permission. It requires changesets CLI v3, which has its own breaking changes, so it is a separate follow-up.