ci: migrate npm publishing to OIDC trusted publishing - #318
Merged
Conversation
Add id-token: write, drop NODE_AUTH_TOKEN/NPM_TOKEN, and upgrade npm to >= 11.5.1 in-job so the publish authenticates via npm OIDC trusted publishing. Emit provenance from publish-npm.sh (GitHub-hosted runner). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (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.
What & why
Replace the long-lived
NPM_TOKENin the npm release with npm OIDC trusted publishing (GA'd 2025-07-31). The release job exchanges a short-lived GitHub Actions id-token for publish credentials — no stored secret — and provenance is issued automatically.Changes
release.yml: addid-token: writetopermissions(it was missing); remove theNODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}env; add annpm install -g npm@lateststep (trusted publishing needs npm ≥ 11.5.1). The job already runs onubuntu-latest(GitHub-hosted), required for OIDC.scripts/publish-npm.sh: add--provenanceto thenpm publishcalls; update the header comment (no token needed).docs/distribution/{npm,release,README}.mdnow describe OIDC trusted publishing and drop theNPM_TOKENsecret.Register the trusted publisher on npm for all 5 packages first, otherwise the tokenless publish fails:
@c3-oss/prosa+-darwin-arm64,-darwin-amd64,-linux-amd64,-linux-arm64— repoc3-oss/prosa, workflowrelease.yml. Run the org-widesetup-trusted-publishers.sh.Suggested validation: cut a pre-release tag (e.g.
v<next>-rc1) and confirm the publish is green with a provenance badge and noNPM_TOKENuse. Keep theNPM_TOKENsecret until validated, then delete it.🤖 Generated with Claude Code