ci: publish through npm trusted publishing - #199
Merged
Conversation
The release job authenticates with the npm registry through GitHub's OIDC token instead of the `NPM_TOKEN` secret: `id-token: write` on the job, no `registry-url` in `actions/setup-node`, no `NODE_AUTH_TOKEN`, and Node.js 24 for the npm CLI 11.5.1+ that trusted publishing needs. The explicit `permissions` block also keeps `contents: write` and `pull-requests: write`, which the pull request and release flows of the job use. Provenance attestations come with it. Requires the trusted publisher to be registered for every published package on npmjs.com: repository `TrigenSoftware/simple-release`, workflow `release.yml`.
Coverage Report for CI Build 33974152487Coverage remained the same at 69.769%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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
Switches the release job from the
NPM_TOKENsecret to npm trusted publishing (OIDC), the same setup as in nano_kit, Argue, and nanoviews:permissionson thereleasejob:contents: write,pull-requests: write(what the pull request and release flows already use through the default write permissions), plusid-token: writefor the OIDC token.actions/setup-node: Node.js 24, which ships npm 11.5.1+ — the minimum for trusted publishing;registry-urldropped, there is no token to write into.npmrc.NODE_AUTH_TOKENenv dropped from the release step.pnpm publish --recursivedelegates to npm, so nothing changes inpackages/ci. All eight published packages haverepository.urlpointing at this repository, andclean-publishkeeps the field, so the automatic provenance check passes.Before merging the next release pull request
Register the trusted publisher for every published package on npmjs.com — repository
TrigenSoftware/simple-release, workflow filenamerelease.yml— either in each package's Settings → Trusted Publisher → GitHub Actions, or with the npm CLI (11.15+, two-factor authentication):Without the registrations the publish step of the next release fails with
ENEEDAUTHafter the tag is created. Once a release has gone through, theNPM_TOKENsecret and the token itself can be removed.Test plan
releasejobnpm notice publish Signed provenance statement ...🤖 Generated with Claude Code