Repository navigation
ci(release): Publish npm packages with OIDC trusted publishing - #5275
Draft
thomas-lebeau wants to merge 3 commits into
Draft
thomas-lebeau wants to merge 3 commits into
thomas-lebeau wants to merge 3 commits into
Conversation
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 326cb20 | Docs | View more details | Give us feedback! |
thomas-lebeau
force-pushed
the
thomas.lebeau/RUM-19961-npm-oidc
branch
from
November 20, 2026 19:02
82732dc to
aff6653
Compare
- Disable the dependency cache and persisted git credentials in the publishing job. - Give the job a 30 minute timeout, and wait up to 40 minutes for it from GitLab (queueing included, under the GitHub token lifetime). - Say in the GitLab error that retrying the job is safe.
thomas-lebeau
force-pushed
the
thomas.lebeau/RUM-19961-npm-oidc
branch
from
November 26, 2026 09:36
aff6653 to
326cb20
Compare
This was referenced Nov 26, 2026
This branch has not been deployed
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.
Motivation
RUM-19961.
step-6_publish-npmpublishes from GitLab with a long-lived npm token that bypasses 2FA (ci.browser-sdk.npm_token). These tokens will be unable to publish starting January 2027 (deprecation). NPM Releases Best Practices recommends OIDC trusted publishing, which only works from GitHub Actions.Changes
GitLab keeps control of when we publish (after the CDN regions, behind the cordon check, before the developer extension), but the publish itself runs in GitHub Actions:
.github/workflows/publish-npm.yml(new): runs onworkflow_dispatchin thenpm-publishenvironment, withid-token: write. It checks that the ref is thev<package.json version>tag, runsyarn install --immutable, then runspublish-npm.tswith provenance turned on (YARN_NPM_CONFIG_PROVENANCE). The job has no dependency cache, no persisted git credentials and a 30-minute timeout.publish-npm.ts: no longer reads the npm token. Yarn 4.18.1 swaps the GitHub OIDC token for a short-lived npm token on its own. SettingYARN_NPM_AUTH_TOKENby hand still works, for a new package's first publish. The failure hint now points to the trusted publisher settings.publish-npm-on-github.ts(new), run bystep-6_publish-npmin deploy-auto and deploy-manual: it starts the workflow onvX.Y.Zwithreturn_run_details: true, which returns the run id and URL directly, prints the run URL, then checks the run until it completes. It fails if the conclusion isn'tsuccessor after 40 minutes (the job timeout plus time in the queue, less than the one-hour token lifetime). The error says that a retry is safe..github/chainguard/self.gitlab.publish.sts.yaml(new): a tag-only dd-octo-sts policy withactions: write.getNpmTokenis removed (no longer used).renew-token.tsand the SSM secret stay until after the first OIDC release.Before merging, outside this repo:
npm-publishGitHub environment, limited tov*tagsDataDog/browser-sdk,publish-npm.yml, envnpm-publish) via #guild-dd-node-jsAfter the first successful release: enforce "Require 2FA and disallow tokens", then delete
ci.browser-sdk.npm_token,renew-token.tsand the release workflow page's token instructions.Not verified yet (checked by the test-tag run below):
return_run_details) works with our API version headerTest instructions
yarn test:scriptcoverspublish-npm.spec.tsand the newpublish-npm-on-github.spec.ts: it dispatches on the release tag, waits for the run to complete, and fails on failure, cancellation or timeout.package.jsonversion and runstep-6_publish-npmfrom deploy-manual. Check the run URL in the job log, and that the run either publishes with provenance or is a no-op with--tolerate-republish.Checklist
Refs: RUM-19961