Repository navigation
ci: publish to npm via trusted publishing behind a release environment - #2936
Merged
Merged
Conversation
Replace the long-lived NPM_TOKEN with npm trusted publishing (OIDC) in manual_release.yml and push_main.yml, matching publish_native.yml. All three publish jobs now run in the `release` GitHub environment, so required reviewers and branch rules gate every publish. - Install npm 11.6.2 before publishing (OIDC needs npm >= 11.5.1). - Replace JS-DevTools/npm-publish with an explicit npm publish step. - Drop `secrets: inherit` from the publish_native.yml calls; it uses none. Co-Authored-By: Claude Opus 5.5 <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.
Summary
Move all npm publishing to npm trusted publishing (OIDC) and gate it with a GitHub environment. With this change, publishing does not use a long-lived npm token, and only an approved run from an allowed branch can publish.
manual_release.ymlandpush_main.yml:Release-on-NPMnow runs in thereleaseenvironment and authenticates with OIDC. I removedNPM_TOKEN.push_main.yml: replaceJS-DevTools/npm-publish@v3, which requires a token, with the same "skip if the version exists, elsenpm publish --provenance" step thatmanual_release.ymluses.publish_native.yml:publish-native-packagesnow runs in thereleaseenvironment. It already used OIDC.secrets: inheritfrom thepublish_native.ymlcalls. That workflow uses no secrets.Behavior difference: the old
strategy: upgradealso skipped versions lower than the version on npm. The new step skips only versions that already exist.Check-Version-Changestill skips prereleases and unchanged versions.Required before merge
The next release fails unless these settings exist:
releasewith required reviewers and "prevent self-review". Limit deployment branches tomainand any release branches.o1js→ Trusted publishing: addo1-labs/o1js+manual_release.ymlando1-labs/o1js+push_main.yml, both with environmentrelease.@o1js/nativeplatform package and the meta package. npm checks the calling workflow file for reusable workflows.After the first OIDC release works, delete the
NPM_TOKENrepo secret and revoke the token on npm.Verification
actionlint reports no new findings. The workflows have not run yet. The first release is the end-to-end test.
🤖 Generated with Claude Code