@@ -8,30 +8,55 @@ Status as of writing:
88- the repository is public at < https://github.com/PerryLink/jevcore > , with CI
99 green, and a mirror is pushed to Gitee at
1010 < https://gitee.com/perrylink/jevcore > ;
11- - the ` Publish ` workflow is in place for future releases, but it needs an
12- ` NPM_TOKEN ` repository secret before a tag push can use it (below).
11+ - the ` Release ` workflow is in place, authenticated by OIDC trusted publishing:
12+ there is no token to add and none to rotate (below).
1313
1414Run every step from the repository root.
1515
16- ## Before the next release: add the NPM_TOKEN secret
16+ ## Before the next release: configure trusted publishing, once per package
1717
1818The 0.1.0 release was published from a laptop, which works but produces no
19- provenance attestation. To release the next version through the workflow:
20-
21- 1 . Create an npm ** automation** token with publish rights for ` jevcore ` ,
22- ` jevcore-dsh ` and ` jevcore-mcp ` (npm → Access Tokens → Generate New Token →
23- Automation; automation tokens bypass 2FA, which CI needs).
24- 2 . Add it to the repository: ** Settings → Secrets and variables → Actions → New
25- repository secret** , named ` NPM_TOKEN ` .
26- 3 . Bump the version in all four manifests and ` pnpm install ` , then push a ` v* `
27- tag.
28-
29- Without that secret the workflow ** fails** rather than skipping, deliberately: a
30- tag that "passes" while publishing nothing is easy to mistake for a release.
31-
32- The token is never written to this repository or any of its files. It belongs in
33- repository secrets, and locally only in the environment of the command that needs
34- it.
19+ provenance attestation. Releases now go through the workflow, and the workflow
20+ holds no credential at all:
21+
22+ 1 . On npmjs.com, open each package — ` jevcore ` , ` jevcore-dsh ` , ` jevcore-mcp ` —
23+ and under ** Settings → Trusted Publisher → GitHub Actions** set:
24+
25+ | Field | Value |
26+ | ---| ---|
27+ | Organization or user | ` PerryLink ` |
28+ | Repository | ` jevcore ` |
29+ | Workflow filename | ` release.yml ` |
30+ | Environment | * (leave empty)* |
31+
32+ 2 . Bump the version in all four manifests and ` pnpm install ` , then push a ` v* `
33+ tag. The runner mints an OIDC token, npm exchanges it for publish rights on
34+ exactly those three packages, and the release carries a provenance
35+ attestation.
36+
37+ ** The workflow filename is matched exactly, extension included.** Renaming
38+ ` .github/workflows/release.yml ` breaks the release until the npm side is updated
39+ to match, and the symptom is an authentication failure, not a missing workflow.
40+ ` release.yml ` is also what 38 of the sibling plugin repositories call theirs
41+ (` publish.yml ` appears in 7), so the name follows the ecosystem rather than the
42+ verb.
43+
44+ Do not add an ` NPM_TOKEN ` back, and do not add ` registry-url ` to the
45+ ` setup-node ` step: both write ` //registry.npmjs.org/:_authToken ` into ` .npmrc ` ,
46+ and pnpm treats a configured token as an instruction to publish with it and skips
47+ the OIDC exchange. A stale value there downgrades the release to token publishing
48+ and fails on auth, which is harder to diagnose than no token at all.
49+
50+ ### Why hand-publishing no longer works, recorded so it is not repeated
51+
52+ With 2FA enabled on the account, an automation token can no longer publish
53+ directly. ` pnpm publish ` ** prints ` ✅ Published ` and exits 0 while only * staging*
54+ the version** for a later approval, and the staged version then occupies the
55+ version number: the registry does not list it, a re-publish fails with
56+ ` 409 Cannot publish over previously staged version ` , and ` npm stage list ` reports
57+ ` total: 0 ` for it, so the stage-id needed to approve or reject it cannot be
58+ obtained from the CLI. That is how 0.2.2 was consumed without ever being
59+ published.
3560
3661### Why the first attempt failed, recorded so it is not repeated
3762
@@ -233,33 +258,30 @@ For the next release: bump the version in all four manifests, move the
233258then push the matching tag:
234259
235260``` sh
236- git tag -a v0.1.1 -m " 0.1.1 "
261+ git tag -a v0.2.3 -m " 0.2.3 "
237262git push origin main --follow-tags
238- gh run watch # follow the Publish run
263+ gh run watch # follow the Release run
239264```
240265
241- The ` Publish ` workflow (` .github/workflows/publish.yml ` ) triggers on a ` v* ` tag.
242- It verifies that every manifest agrees with the tag, re-runs the full check and
243- the vendor schema cross-check, then publishes the three packages ** in dependency
244- order** with provenance. Order matters: both adapters depend on ` jevcore ` .
245-
246- Requires the ` NPM_TOKEN ` repository secret described at the top of this file. If
247- that secret is missing the run fails rather than skipping — deliberately, because
248- a tag that "passes" while publishing nothing is easy to mistake for a release.
249-
250- You can rehearse without publishing: ** Actions → Publish → Run workflow** with
251- ` dry-run ` left checked. It packs and verifies, and stops.
252-
253- Publishing by hand is possible but second best, because it has no provenance
254- attestation — and it is how 0.1.0 went out:
255-
256- ``` sh
257- # Needs a token in the environment. `pnpm`, never `npm`, so the `workspace:*`
258- # dependency is rewritten to a real version.
259- pnpm --filter jevcore publish --access public --no-git-checks
260- pnpm --filter jevcore-dsh publish --access public --no-git-checks
261- pnpm --filter jevcore-mcp publish --access public --no-git-checks
262- ```
266+ The ` Release ` workflow (` .github/workflows/release.yml ` ) triggers on a ` v* ` tag.
267+ It verifies that every manifest agrees with the tag, re-runs the full check, then
268+ publishes the three packages ** in dependency order** with provenance. Order
269+ matters twice over: both adapters depend on ` jevcore ` , and pnpm rewrites that
270+ ` workspace:* ` dependency into the released version number, so publishing an
271+ adapter before the core would point it at a version that does not exist yet.
272+
273+ Authentication is the trusted publisher configured at the top of this file. There
274+ is no secret to be missing, so the failure mode that secret had — a tag that
275+ "passes" while publishing nothing — cannot recur here.
276+
277+ You can rehearse without publishing: ** Actions → Release → Run workflow** . The
278+ publish step is gated on ` github.event_name == 'push' ` , so a manual run verifies
279+ everything and stops before touching the registry.
280+
281+ Publishing by hand is now ** not** a fallback — see "Why hand-publishing no longer
282+ works" above. It reports success while only staging the version, which then
283+ blocks that version number permanently until someone approves or rejects it on
284+ the npm website. If the workflow cannot publish, fix the workflow.
263285
264286Then verify by installing from the registry into an empty directory, not by
265287reading the publish output:
0 commit comments