|
69 | 69 | - name: Format check |
70 | 70 | run: bun run format:check |
71 | 71 |
|
72 | | - # Fail fast on bad/missing NPM_TOKEN before any side effects |
73 | | - # (version.ts writes to package.json, network calls to GH, etc.) |
74 | | - # Surfaces auth issues in ~2s instead of mid-publish. |
| 72 | + # npm whoami does NOT support OIDC trusted publishing — it only |
| 73 | + # works with a static token. We keep NODE_AUTH_TOKEN here so this |
| 74 | + # pre-publish sanity check still works. The actual publish step |
| 75 | + # authenticates via OIDC (no token needed). |
75 | 76 | - name: Verify npm auth |
76 | 77 | run: npm whoami --registry=https://registry.npmjs.org/ |
77 | 78 | env: |
@@ -107,11 +108,15 @@ jobs: |
107 | 108 | # recovery handler prints the exact manual recovery commands. |
108 | 109 | # ============================================================ |
109 | 110 |
|
| 111 | + # Authentication for npm publish uses OIDC trusted publishing — |
| 112 | + # no NODE_AUTH_TOKEN needed. npm CLI auto-detects the OIDC |
| 113 | + # environment when id-token: write is set and no token is present. |
| 114 | + # Configured on npmjs.com under package settings → Trusted Publishers. |
| 115 | + # Requires npm CLI v11.5.1+ and Node 22.14.0+. |
110 | 116 | - name: Publish to npm |
111 | 117 | id: publish |
112 | 118 | run: bun script/publish.ts |
113 | 119 | env: |
114 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
115 | 120 | NPM_CONFIG_PROVENANCE: "true" |
116 | 121 | KILO_CHANNEL: ${{ steps.version.outputs.channel }} |
117 | 122 |
|
@@ -155,6 +160,9 @@ jobs: |
155 | 160 | # |
156 | 161 | # Like the verify step above, this is INFORMATIONAL only — |
157 | 162 | # it never fails the workflow and never blocks tag/release. |
| 163 | + # npm dist-tag add is a write operation NOT covered by OIDC |
| 164 | + # trusted publishing (OIDC only covers npm publish). Still |
| 165 | + # needs the static token. |
158 | 166 | - name: Reconcile latest dist-tag (dev publishes) |
159 | 167 | if: steps.publish.outcome == 'success' && steps.version.outputs.channel == 'dev' |
160 | 168 | env: |
|
0 commit comments