Commit bf62928
ci: publish to npm via trusted publishing instead of a stored token (#549)
* ci: publish to npm via trusted publishing instead of a stored token
The crates.io job has been using trusted publishing for a while, but the two
npm jobs still authenticated with `secrets.NPM_TOKEN` — they set
`//registry.npmjs.org/:_authToken` from it and only used `id-token: write` to
attest provenance. So a long-lived npm credential with publish rights to the
whole scope sat in the repository's secrets, which is the thing trusted
publishing exists to remove.
Dropping the token is the whole change: npm 11.5.1+ detects the Actions OIDC
token on its own, exchanges it for a short-lived publish credential, and
generates provenance automatically on that path. The `npm install -g` pin moves
from `npm@11` to `npm@^11.5.1` to state the version that behavior needs. The
`--provenance` flags stay: they are redundant under trusted publishing but keep
the intent visible, and `publishConfig.provenance` already requests it anyway.
The `npm` environment is now load-bearing rather than decorative. A trusted
publisher entry names the repository, the workflow file, and the environment,
so all three are part of the identity — renaming any of them stops publishing
until every package's entry is updated. Both are called out where they appear.
Trusted publishing cannot create a package that does not exist yet, because the
publisher entry lives on the package's settings page. `release.md` now
documents that bootstrap step for npm alongside the equivalent crates.io one,
including the version-bump-before-pack detail that decides whether the tarball
pins its `@ox-content/*` dependencies to the right release.
Setup this needs before the next tag: a trusted publisher entry per package on
npmjs.com, and `NPM_TOKEN` can be revoked once they are in place.
* ci: pin the npm version installed in the publish jobs
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
---------
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>1 parent a653089 commit bf62928
2 files changed
Lines changed: 75 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | | - | |
149 | | - | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| |||
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 171 | + | |
169 | 172 | | |
170 | | - | |
171 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
| |||
276 | 284 | | |
277 | 285 | | |
278 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
279 | 291 | | |
280 | | - | |
281 | | - | |
282 | 292 | | |
283 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
284 | 297 | | |
285 | 298 | | |
286 | 299 | | |
| |||
295 | 308 | | |
296 | 309 | | |
297 | 310 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
304 | 320 | | |
305 | 321 | | |
306 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
48 | 92 | | |
49 | 93 | | |
50 | 94 | | |
| |||
0 commit comments