Skip to content

fix: remove registry-url to restore OIDC Trusted Publisher - #33

Merged
maplezzk merged 2 commits into
mainfrom
fix/remove-registry-url
Apr 28, 2026
Merged

maplezzk merged 2 commits into
mainfrom
fix/remove-registry-url

Conversation

@maplezzk

Copy link
Copy Markdown
Owner

根因

809f5d7 在添加 prerelease tag 支持时,不小心把 registry-url: 'https://registry.npmjs.org' 加回了 setup-node。

setup-node@v4 配了 registry-url 会自动生成 .npmrc:

//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}

当 NODE_AUTH_TOKEN 为空时(OIDC Trusted Publisher 不需要它),.npmrc 中会留下一个空 token:

//registry.npmjs.org/:_authToken=

这个空 token 干扰了 npm CLI 的 OIDC 自动检测——npm 优先读取 .npmrc 中的空 token 而不是走 OIDC 流程,导致认证失败,registry 返回 404。

这也能解释为什么 provenance 签名成功(sigstore 用的是独立的 OIDC token)但 npm publish 的 PUT 请求失败。

修复

Claude Bot and others added 2 commits April 28, 2026 23:22
registry-url in setup-node generates .npmrc with empty _authToken,
which interferes with npm's OIDC auto-detection, causing 404 on publish.

Root cause: commit 809f5d7 accidentally re-added registry-url while
adding prerelease tag support. This broke the Trusted Publisher setup
from 200cd9b.

Also revert the incorrect NODE_AUTH_TOKEN fix from PR #32.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@maplezzk
maplezzk merged commit 2925cbd into main Apr 28, 2026
1 check passed
@maplezzk
maplezzk deleted the fix/remove-registry-url branch April 28, 2026 15:23
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