Skip to content

Publish releases with npm trusted publishing - #2

Merged
cprice70 merged 1 commit into
mainfrom
users/cprice/trusted-publishing
Oct 12, 2026
Merged

cprice70 merged 1 commit into
mainfrom
users/cprice/trusted-publishing

Conversation

@cprice70

Copy link
Copy Markdown
Owner

Summary

  • Release workflow now authenticates to npm with OIDC trusted publishing instead of a stored token: permissions: id-token: write, npm upgraded on the runner (trusted publishing needs npm 11.5.1+; Node 22 ships older), NODE_AUTH_TOKEN removed.
  • package.json repository normalized to an object via npm pkg fix, which npm warned about on every publish.
  • README gains a Releasing section.

Why

The v2.0.0 release failed three times: first on an expired NPM_TOKEN, then with EOTP because npm no longer lets granular tokens bypass 2FA on publish. Trusted publishing removes tokens and OTPs from the release path.

Before merging

On npmjs.com, package amazonads-cli > Settings > Trusted Publisher: add GitHub Actions with organization/user cprice70, repository amazonads-cli, workflow filename release.yml, environment left blank. After merge, delete the NPM_TOKEN repository secret and any npm tokens created on 2026-10-11.

Testing

  • npx vitest run: 31 passing.
  • Workflow YAML unchanged apart from the permissions block, the npm upgrade step, and the removed env. Cannot be exercised until the trusted publisher exists on npm and a tag is pushed.

Switch the release workflow from a stored NPM_TOKEN to OIDC trusted
publishing: grant id-token: write, upgrade npm on the runner to a version
that supports it, and drop NODE_AUTH_TOKEN. Token-based publishes to a
2FA-protected account now fail with EOTP, and granular tokens can no
longer bypass 2FA.

Also normalize the package.json repository field (npm pkg fix) and
document the release steps in the README.
@cprice70
cprice70 merged commit fa490be into main Oct 12, 2026
2 checks passed
@cprice70
cprice70 deleted the users/cprice/trusted-publishing branch October 12, 2026 00:54
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.

1 participant