Switch npm publish to OIDC trusted publisher#37
Conversation
Co-authored-by: einari <134365+einari@users.noreply.github.com>
|
@copilot look at one of the previous Git commits and sessions we’ve had (pull requests) - you took away the registry with the argument it would screw things up. So I think you need to make up your mind |
You're right to call that out. The previous session's reasoning was incorrect — it removed Here's what each part does:
Without The correct setup for OIDC trusted publishing is: |
|
@copilot but since we've already been down this path. What makes you think it'll work now? |
|
@copilot take a look at the git history to see what I mean |
Fair challenge. Full CI history shows two distinct problems: Problem 1 — ENEEDAUTH (runs #59): Caused by removing Problem 2 — 404 "not in this registry" (runs #54, #55, #57): This was happening before the So to directly answer your question: restoring The root cause of the 404 is most likely one of:
The practical path forward is: configure the |
Here's the complete chain from the git history:
The 404 errors in runs #54–57 happened at commits Looking at the 404 message: So: this PR's change ( |
npm publish was failing with
ENEEDAUTHdespite the job havingid-token: write. A review of the full git history reveals a cycle of conflicting changes across multiple sessions:8553e16registry-url+NODE_AUTH_TOKENba04061NODE_AUTH_TOKEN, addedid-token: writeregistry-urlstill present — correctda8278f/dda0104NODE_AUTH_TOKENagain during debugginga6ac27aregistry-urlunder mistaken assumption it interfered with OIDCENEEDAUTH61ffcb2registry-url(this PR)ENEEDAUTHregistry-urlis required — it causessetup-nodeto write the.npmrcentry so npm knows which registry to authenticate against. Without it, npm has no registry context and fails withENEEDAUTHbefore even attempting to publish. WithoutNODE_AUTH_TOKENset, npm automatically falls back to the OIDC token exchange for the Trusted Publisher flow.The 404 errors seen in earlier runs (
'@cratis/components@1.4.4' is not in this registry) are a separate issue unrelated to workflow configuration — they indicate the npm Trusted Publisher is not yet configured at the@cratisorg level on npmjs.org.Fixed
registry-url: 'https://registry.npmjs.org'tosetup-nodeinpublish-npm-packages— this causessetup-nodeto write the.npmrcentry that enables npm to exchange the GitHub OIDC token with the registry, resolving theENEEDAUTHerror introduced by commita6ac27a📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.