Commit afd574d
ci: publish to npm by trusted publishing instead of a stored token
Removes the NPM_TOKEN requirement. npm now trades the short-lived OIDC token
GitHub mints for this specific workflow run for permission to publish, so there
is no long-lived credential in the repository to leak, rotate or forget — and
none had to be minted, since the secret was never added.
Two things that would have failed quietly otherwise:
Node 22 bundles npm 10, which predates trusted publishing and falls back to
looking for a token that no longer exists — an auth failure that reads as a
credential problem rather than a version one. So npm is upgraded first, and the
11.5.1 floor is checked rather than assumed. The check compares with `sort -V`:
lexically, 11.16.0 is lower than 11.5.1.
`--provenance` is gone because trusted publishing generates and attaches the
attestation itself.
The other half of the trust lives on npmjs.com under the package's Trusted
Publisher settings, and it is pinned to this file's *name*. Renaming
publish.yml breaks publishing with no other symptom, which the header now says.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent a0d3145 commit afd574d
1 file changed
Lines changed: 31 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| |||
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
47 | 70 | | |
48 | 71 | | |
49 | 72 | | |
| |||
88 | 111 | | |
89 | 112 | | |
90 | 113 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 114 | + | |
| 115 | + | |
103 | 116 | | |
104 | 117 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 118 | + | |
108 | 119 | | |
109 | 120 | | |
110 | 121 | | |
| |||
0 commit comments