Skip to content

fix(ci): restore token auth with provenance for npm publishing#76

Merged
iamfj merged 1 commit intomainfrom
fix/publish-granular-token
Apr 7, 2026
Merged

fix(ci): restore token auth with provenance for npm publishing#76
iamfj merged 1 commit intomainfrom
fix/publish-granular-token

Conversation

@iamfj
Copy link
Copy Markdown
Member

@iamfj iamfj commented Apr 7, 2026

Problem

npm publish --provenance without a token fails with ENEEDAUTH. OIDC provenance does not replace token authentication — it adds a signed attestation alongside the publish. The trusted publisher config on npmjs.com makes provenance mandatory, but a token is still required to authorize the request.

Fix

Restore registry-url and NODE_AUTH_TOKEN from NPM_TOKEN secret. Combined with --provenance and id-token: write, this gives us both token auth and provenance attestation.

Setup required

The NPM_TOKEN secret in the npm-publish environment must be a granular access token (not a classic/automation token):

  1. npmjs.com → Access Tokens → Generate New Token → Granular Access Token
  2. Packages: select linearis, permission Read and write
  3. Store as NPM_TOKEN in Settings → Environments → npm-publish → Secrets

Granular tokens bypass 2FA by design, avoiding the EOTP error that classic tokens cause in CI.

After merge

git pull origin main
git tag -d v2026.4.1
git push origin :refs/tags/v2026.4.1
git tag -a v2026.4.1 -m "Release 2026.4.1"
git push origin v2026.4.1

OIDC provenance does not replace token authentication — npm
requires a token to authorize the publish request. Provenance
adds a signed attestation and the trusted publisher config on
npmjs.com makes it mandatory.

Restore registry-url and NODE_AUTH_TOKEN from NPM_TOKEN secret.
Use a granular access token which bypasses 2FA (unlike classic
tokens that require OTP).
@iamfj iamfj merged commit e7581b6 into main Apr 7, 2026
2 checks passed
@iamfj iamfj deleted the fix/publish-granular-token branch April 21, 2026 21:16
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