[SDK-720] Publish to npm with trusted publishing - #32
Open
devtools-agent[bot] wants to merge 2 commits into
Open
devtools-agent[bot] wants to merge 2 commits into
devtools-agent[bot] wants to merge 2 commits into
Conversation
Add .github/workflows/publish.yml, which runs on release: published and publishes to npm via OIDC trusted publishing (no NPM_TOKEN). It checks out the release tag, fails unless package.json's version matches the tag (minus a leading v), runs npm ci and the build if one exists, then npm publish --provenance --access public. Pre-release versions publish under the next dist-tag. npm ci needs a lockfile, so package-lock.json is no longer gitignored and is committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rollbar-circleci-machine
left a comment
There was a problem hiding this comment.
AI Agent Review (openai, openai-astra)
Review: publish to npm with trusted publishing
The workflow is small and generally sound:
- OIDC: permissions are limited to
id-token: writeandcontents: read. - Injection: the release tag reaches the shell through
env(TAG), not direct${{ }}interpolation. - Dist-tag: it can only be the fixed strings
nextorlatest. - Version check: it correctly strips a leading
vfrom the tag. - Provenance:
repository.urlinpackage.json(git+https://github.com/rollbar/rollbar-cli.git) matches this repo. - Lockfile: the new
package-lock.jsonis lockfileVersion 3 and its root entry matchespackage.json(version 0.2.1, same dependency ranges). All 460resolvedURLs point athttps://registry.npmjs.org/, with no private or mirror registries. npm never includespackage-lock.jsonin the published tarball, so committing it doesn't affect consumers. - Install scripts: the project
.npmrcsetsignore-scripts=true, sonpm ciin the publish job won't run dependency install scripts.
One finding (low): the publish job never runs npm test, and the existing CI workflow doesn't cover tag commits well enough to make up for it (see the inline comment).
Outside the changed files (not findings):
.github/workflows/node.js.yml:32-35refers tomatrix.node-version, but the matrix only definesnodeandnpm(lines 17-28). So CI never actually tests the Node/npm matrix, only the runner's default Node.- The same workflow runs
npm install, notnpm ci. Now that the lockfile is committed, CI won't catch apackage.jsonchange that leavespackage-lock.jsonout of date. The first time that shows up would be thenpm cistep here, at release time. Switching CI tonpm ciwould catch it earlier. package.jsonhas nofilesfield and there's no.npmignore, so the published tarball includestest/(including the large angular9/react16 fixture builds) and.github/. This is how the package was already being published, but it's worth addingfilesnow that publishing is automated.actions/checkout@v4andactions/setup-node@v4are pinned to major tags, not commit SHAs. Consider pinning them, since this job can mint a publish token.
This is a static review only. Nothing was run, and I make no claim about the workflow succeeding end to end.
Gate npm publish on `npm test` so a release cut from a tag that CI never tested cannot reach npm with a failing suite. Coverage output is gitignored, so it stays out of the published tarball. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI Agent Review (openai, openai-astra)Review: npm trusted publishing workflow + committed lockfileNo problems found on the changed lines. What I checked
Worth fixing, outside this diff (not reported as findings)
Optional hardening (a policy choice, not a defect)
I couldn't run anything, so I haven't confirmed that the tests pass on Node 24 or that a publish succeeds. |
brianr
approved these changes
Sep 30, 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.
Linear: SDK-720
What changed
.github/workflows/publish.yml(new): runs onrelease: publishedwithpermissions: { id-token: write, contents: read }.github.event.release.tag_name).actions/setup-node@v4(registryhttps://registry.npmjs.org), thennpm install -g npm@^11.5.1, since trusted publishing needs npm 11.5.1+.::error::unlesspackage.json'sversionequals the tag with any leadingvremoved.npm ci, thennpm run build --if-present(rollbar-cli has no build script today, so this is a no-op until one exists).npm test, so every publish is gated on a passing suite.node.js.ymlonly runs on pushes and PRs tomaster, so a release cut from a tag on any other commit would otherwise reach npm untested. The coverage output (coverage/,.nyc_output/) is gitignored, so it stays out of the tarball.npm publish --provenance --access public --tag <latest|next>: versions with a pre-release part (e.g.3.2.0-rc.1) go tonext, everything else tolatest. NoNPM_TOKENanywhere.package-lock.jsonis now committed and removed from.gitignore, becausenpm cifails without a lockfile. It was generated withnpm install --package-lock-onlyagainst the currentpackage.jsonand no dependency versions changed.node.js.ymlis unchanged.Why
This moves releases to npm trusted publishing (OIDC plus provenance) so no long-lived npm token is needed. The matching trusted publisher on npmjs.com must name workflow file
publish.yml.Validation
v0.2.1/0.2.1with 0.2.1 →latest;v3.2.0-rc.1with 3.2.0-rc.1 →next; any mismatch fails.npm cisucceeded,npm run build --if-presentwas a no-op,npm testpassed (36 passing), andnpm publish --dry-run --access public --tag nextshowedrollbar-cli@0.2.1going to registry.npmjs.org.ignore-scripts=true,npm teststill runs (36 passing), andnpm pack --dry-runafterwards includes nocoverage/or.nyc_output/files.🤖 Generated with Claude Code