ci: publish to npm via trusted publishing#252
Open
christianalfoni wants to merge 1 commit into
Open
Conversation
Add a release.yml workflow that publishes to npm using Trusted Publishing (OIDC) instead of a long-lived NPM_TOKEN. It is triggered by the GitHub Release that Release Please creates on merge. release-please.yml now only handles release creation; the build and publish steps move to release.yml, which is the workflow npm is configured to trust. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
mohamedveron
approved these changes
Jun 18, 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.
What
Switch npm publishing from a long-lived
NPM_TOKENto Trusted Publishing (OIDC)..github/workflows/release.yml— publishes to npm via OIDC. Triggered by therelease: publishedevent, withid-token: writepermission, updates npm to a version that supports trusted publishing (≥ 11.5.1), and runsnpm publishwith noNODE_AUTH_TOKEN.release-please.yml— slimmed to only create the release PR / GitHub Release. Build + publish moved torelease.yml.Flow
main→ Release Please opens/updates a release PR.release: publishedevent triggersrelease.yml, which publishes to npm.This works because Release Please creates the release with
RELEASE_PLEASE_TOKEN(a PAT), so the release event can trigger downstream workflows (the defaultGITHUB_TOKENwould not).Before merging
release.ymloncodesandbox/codesandbox-sdk— the OIDC claim must match exactly.NPM_TOKENsecret is now unused and can be removed after a successful publish.🤖 Generated with Claude Code