Skip to content

feat: upgrade npm CLI and use trusted publishing (OIDC) for prerelease#1257

Merged
thebiglabasky merged 3 commits intomainfrom
chore/upgrade-npm-in-release-workflow
Mar 13, 2026
Merged

feat: upgrade npm CLI and use trusted publishing (OIDC) for prerelease#1257
thebiglabasky merged 3 commits intomainfrom
chore/upgrade-npm-in-release-workflow

Conversation

@thebiglabasky
Copy link
Contributor

@thebiglabasky thebiglabasky commented Mar 13, 2026

Summary

  • Upgrades npm CLI to latest in both prerelease and release jobs (Node 20.x bundles npm ~10.x, trusted publishing requires >= 11.5.1)
  • Removes NODE_AUTH_TOKEN from the prerelease job only — npm will authenticate via GitHub OIDC token exchange instead of a long-lived token
  • The release job keeps NPM_TOKEN as a safety net until OIDC is proven in production
  • Same npm upgrade applied to release-canary.yml for consistency

How it works

NPM trusted publishing uses the same GitHub OIDC mechanism as AWS OIDC:

  1. GitHub Actions mints a signed JWT asserting repo/workflow identity
  2. npm validates it against the trusted publisher config on npmjs.com
  3. npm issues a short-lived publish token — no long-lived secret needed

Trusted publishing has been configured on npmjs.com for both checkly and create-checkly packages (org: checkly, repo: checkly-cli, workflow: release.yml).

Docs: https://docs.npmjs.com/generating-provenance-statements

What changes per job

Job Before After
prerelease NPM_TOKEN + npm 10.x OIDC + npm latest
release NPM_TOKEN + npm 10.x NPM_TOKEN + npm latest (unchanged auth)
release-canary NPM_TOKEN + npm 10.x NPM_TOKEN + npm latest (unchanged auth)

Rollback plan

Revert the commit that removes NODE_AUTH_TOKEN from the prerelease job (one line). The NPM_TOKEN secret remains in GitHub. The trusted publisher config on npmjs.com doesn't interfere with token auth.

Risks

  • If OIDC auth fails for the prerelease job, the release job never runs (needs: prerelease) — no broken package reaches latest
  • The npm upgrade has been tested via a canary build on this PR

Test plan

  • Canary build with upgraded npm succeeded
  • Prerelease job publishes successfully via OIDC (verify in CI logs: look for npm notice lines about OIDC)
  • Release job publishes successfully via NPM_TOKEN (unchanged)
  • Both packages appear on npmjs.com with provenance badge

🤖 Generated with Claude Code

…port

Node 20.x bundles npm ~10.x, but trusted publishing requires npm >= 11.5.1.
This adds `npm install -g npm@latest` to both prerelease and release jobs
as a preparatory step. Authentication is unchanged — still uses NPM_TOKEN.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thebiglabasky thebiglabasky requested a review from sorccu March 13, 2026 11:52
Same npm upgrade step as release.yml for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thebiglabasky thebiglabasky added the build Issue regarding building and packaging label Mar 13, 2026
@github-actions
Copy link

🎉 Experimental release successfully published on npm

npm install checkly@0.0.0-pr.1257.f78bf92

Removes NODE_AUTH_TOKEN from the prerelease job. npm will authenticate
via GitHub OIDC token exchange instead of a long-lived token.
The release job still uses NPM_TOKEN as a safety net.

Trusted publishing is configured on npmjs.com for both
'checkly' and 'create-checkly' packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thebiglabasky thebiglabasky changed the title chore: upgrade npm CLI in release workflow feat: upgrade npm CLI and use trusted publishing (OIDC) for prerelease Mar 13, 2026
@thebiglabasky thebiglabasky merged commit 4d99bc6 into main Mar 13, 2026
5 of 6 checks passed
@thebiglabasky thebiglabasky deleted the chore/upgrade-npm-in-release-workflow branch March 13, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issue regarding building and packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants