Repository navigation
ci(release): Publish npm packages with OIDC trusted publishing - #5274
Closed
thomas-lebeau wants to merge 2 commits into
Closed
thomas-lebeau wants to merge 2 commits into
thomas-lebeau wants to merge 2 commits into
Conversation
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 7759a15 | Docs | View more details | Give us feedback! |
Collaborator
Author
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation
We publish the 14 public npm packages from GitLab with a long-lived npm token. 2FA-bypass tokens stop working in January 2027, so releases need to publish with OIDC trusted publishing from GitHub Actions instead, with no stored token. The GitLab deploy pipeline still decides when publishing happens: after the CDN regions, behind the cordon check, and before the developer extension.
Jira: RUM-19961
Changes
.github/workflows/publish-npm.ymlworkflow, started by hand with aversioninput in thenpm-publishenvironment, withid-token: write. It checks that the run is on tagrefs/tags/<version>and thatpackage.jsonhas that version. Then it sets up Node 24, runsyarn install --immutableand runspublish-npm.ts.publish-npm.ts: on GitHub Actions it skips the stored token, so yarn authenticates through OIDC and publishes with--provenance. Anywhere else it still fetches the npm token from SSM, as before.self.gitlab.publish.sts.yaml(actions: write).step-6_publish-npm(auto and manual) keeps the cordon check, then runs the newdispatch-publish-npm.ts. That script starts the workflow onvX.Y.Zwithreturn_run_details, prints the run URL, checks the run every 15 seconds for up to 45 minutes, and fails unless the run succeeds.The npm token secret and
renew-token.tsstay in place for now.Not verified until a real release: the dispatch API returning run details, a run started with the octo-sts token passing the environment's tag rule, and yarn's OIDC publish working end to end.
Needed before the first release (outside this repo):
npm-publishenvironment, restricted tov*tags.After the first successful release: enforce 2FA, delete the token secret and
renew-token.ts, and update the docs.Test instructions
node --test --experimental-test-module-mocks scripts/deploy/publish-npm.spec.ts scripts/deploy/dispatch-publish-npm.spec.tspassed 8/8 (local). The dispatch tests mock the GitHub API and the dd-octo-sts commands and fake the clock. They cover the POST body, success after pending polls, failure and cancelled runs rejecting, an API error rejecting, the 45-minute timeout, and the token being revoked in every case.GITHUB_ACTIONS=true node scripts/deploy/publish-npm.ts --dry-run(local) exited 0. It built and checked all 14 packages without fetching a token; each was skipped as already published (7.17.1). A dry run leaves out--provenance.yarn typecheckare clean (local).Checklist
Refs: RUM-19961