Repository navigation
ci(release): Publish npm packages with OIDC trusted publishing - #5276
Closed
thomas-lebeau wants to merge 1 commit into
Closed
thomas-lebeau wants to merge 1 commit into
thomas-lebeau wants to merge 1 commit into
Conversation
…GitHub Actions Move the npm publish to a publish-npm.yml GitHub workflow that authenticates to npm with OIDC (with provenance). GitLab step-6 keeps the cordon check, then dispatches the workflow on the release tag with a tag-only dd-octo-sts token and waits for the run.
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 8632ce8 | 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
The npm publish currently relies on a long-lived npm token stored in Vault, which has to be renewed regularly. npm trusted publishing (OIDC) removes the secret and adds provenance, but only works from a supported CI provider such as GitHub Actions, not GitLab.
Closes RUM-19961
Changes
publish-npm.ymlGitHub workflow that publishes with OIDC and provenance, in thenpm-publishenvironment, only on avX.Y.Ztag matching thepackage.jsonversion.step-6_publish-npmkeeps the cordon check, then runsdispatch-publish-npm.ts: it dispatches the workflow on the release tag with a tag-onlydd-octo-ststoken (newself.gitlab.publish.sts.yamlpolicy) and waits for the run. Retrying is safe thanks to--tolerate-republish.publish-npm.tsno longer reads the token from Vault (getNpmTokenremoved).NPM_TOKENis an optional escape hatch, for example for the first publish of a new package. It also refuses to publish non-X.Y.Zversions, since packages are always taggedlatest.Test instructions
yarn test:script(newdispatch-publish-npm.spec.ts, updatedpublish-npm.spec.ts).DataDog/browser-sdk,publish-npm.yml, environmentnpm-publish) on each package on npmjs.com, and create thenpm-publishenvironment restricted tov*tags.dry-runenabled.Checklist
Refs: RUM-19961