Skip to content

chore: switch npm publish to OIDC trusted publisher#174

Merged
LiranCohen merged 1 commit into
mainfrom
chore/trusted-publisher
Mar 4, 2026
Merged

chore: switch npm publish to OIDC trusted publisher#174
LiranCohen merged 1 commit into
mainfrom
chore/trusted-publisher

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

  • Remove NPM_TOKEN / NODE_AUTH_TOKEN secrets from the release workflow — npm auth is now handled via GitHub Actions OIDC trusted publishing
  • Bump Node from 20 to 22 (required by npm trusted publishing: Node 22.14.0+ / npm 11.5.1+)
  • id-token: write permission was already set

Before merging

Configure the trusted publisher on https://www.npmjs.com/package/@enbox/gitd/settings:

Field Value
Organization or user enboxorg
Repository gitd
Workflow filename npm-release.yml
Environment name (leave blank)

No secrets to manage or rotate. Provenance attestations are generated automatically.

Remove NPM_TOKEN secret dependency — npm auth is now handled via
GitHub Actions OIDC (id-token: write was already set). Bump Node
to 22 as required by npm trusted publishing.

Requires configuring the trusted publisher on npmjs.com:
  Package:  @enbox/gitd
  Org:      enboxorg
  Repo:     gitd
  Workflow: npm-release.yml
@LiranCohen LiranCohen merged commit b7250c7 into main Mar 4, 2026
6 of 8 checks passed
@LiranCohen LiranCohen deleted the chore/trusted-publisher branch March 4, 2026 20:17
LiranCohen added a commit that referenced this pull request Mar 4, 2026
Node 22 ships npm 10.x which does not support OIDC trusted publishing
(requires npm 11.5.1+). Node 24 ships npm 11+.

The registry-url param in setup-node creates an .npmrc with
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. Since no
NODE_AUTH_TOKEN is set (we removed it in #174), npm uses an empty
token instead of auto-detecting the OIDC environment. Removing
registry-url lets npm default to registry.npmjs.org and perform
OIDC token exchange correctly.
LiranCohen added a commit that referenced this pull request Mar 4, 2026
Node 22 ships npm 10.x which does not support OIDC trusted publishing
(requires npm 11.5.1+). Node 24 ships npm 11+.

The registry-url param in setup-node creates an .npmrc with
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. Since no
NODE_AUTH_TOKEN is set (we removed it in #174), npm uses an empty
token instead of auto-detecting the OIDC environment. Removing
registry-url lets npm default to registry.npmjs.org and perform
OIDC token exchange correctly.
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