Skip to content

ci(release): switch publish step to npm trusted publishing - #42

Merged
codewizdave merged 2 commits into
stagingfrom
docs/release-system-plan
Aug 3, 2026
Merged

ci(release): switch publish step to npm trusted publishing#42
codewizdave merged 2 commits into
stagingfrom
docs/release-system-plan

Conversation

@martyy-code

Copy link
Copy Markdown
Contributor

Summary

Switches the release workflow from NPM_TOKEN (long-lived secret) to npm trusted publishing (OIDC). The job already has id-token: write permission, which is the only GitHub-side requirement. The publish step no longer passes NODE_AUTH_TOKEN.

What changes

release.yml: the Publish packages step no longer has an env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} block. pnpm changeset publish now relies on the OIDC token generated by id-token: write.

Required before this is functional:

  1. Configure the trusted publisher on npmjs.com for @deessejs/errors. Settings: GitHub Actions, repository deessejs/errors, workflow filename release.yml, allowed actions npm publish.

Recommended after the first OIDC publish works:
2. On npmjs.com: Settings → Publishing access → "Require two-factor authentication and disallow tokens". This revokes any remaining token-based publish access; the OIDC trusted publisher is unaffected.
3. Remove the NPM_TOKEN secret from GitHub repo settings.

Effects

  • Token leak surface drops to zero (no long-lived secret in GitHub).
  • npm provenance becomes automatic (badge on the package page).
  • The publish step is now bound to the specific workflow file in this specific repo. A stolen workflow file or token from elsewhere cannot publish.

🤖 Generated with Claude Code

Drops the NODE_AUTH_TOKEN env var from the publish step. The job's
existing 'id-token: write' permission is what GitHub needs to mint the
OIDC token, which npm exchanges for a short-lived publish credential.

Required (by the user, before or after merge):
1. Add a trusted publisher on npmjs.com for @deessejs/errors,
   pointing at deessejs/errors with workflow 'release.yml'.
2. Cut one release via the modified workflow to validate end-to-end.
3. On npmjs.com: Settings -> Publishing access -> 'Require 2FA and
   disallow tokens' (recommended maximum-security posture).
4. Revoke the NPM_TOKEN GitHub secret once the OIDC publish succeeds.

Adds a changeset to pass the new ci.yml lint.
GitHub Environment gives us a deployment record per run, visible in
the Deployments API and the GitHub UI. No protection rules are
attached yet, so the trigger stays label-less / fire-on-every-merge.
Future hardening (required reviewers, branch restrictions, wait
timer, env secrets) can attach to the same environment without
changing this workflow further.

The environment on the npmjs.com trusted publisher config is
intentionally left blank for now; we only point at the workflow
file. Adding environment name on the trusted publisher side would
require the env on the workflow to exist first, which it now does.

Adds a changeset to pass the new ci.yml lint.
@codewizdave
codewizdave merged commit 010b1d9 into staging Aug 3, 2026
5 checks passed
martyy-code added a commit that referenced this pull request Aug 3, 2026
…ronment)

Adds Section 7 (Trusted publishing & environment) to the plan and a
matching Appendix C (Post-plan decision log). Two items are added to
the Definition of done:

- At least one release has been published via npm trusted publishing
  (OIDC), per Section 7.1.
- The GitHub 'release' environment exists with at least one deployment
  record, per Section 7.2.

Plan Status also moves from 'Proposed' to 'Approved and partially
implemented on staging' because Phases 3, 4, 5 plus Section 7 are now
merged on the staging branch (PRs #40, #41, #42).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants