Skip to content

Commit 3b2ace3

Browse files
committed
ci(release): rename the publish workflow to release.yml, matching the trusted publisher
npm matches the trusted publisher's workflow filename exactly, extension included, and all three packages are configured for \ elease.yml\. The repository called the file publish.yml, so a tag push would have failed with an authentication error naming no missing file. The rename is also the ecosystem's convention: 38 sibling plugin repositories use release.yml and 7 use publish.yml. The step ids, the job name and everything else are unchanged; only the filename, the workflow's \ ame\ field, and the header comment that records which string npm must be given. PUBLISHING.md is rewritten around this, because two of its claims had become false: it told the reader to add an NPM_TOKEN secret, which the trusted publisher replaces, and it told them to rehearse through a \dry-run\ input the workflow does not have -- a manual run is already a rehearsal, since the publish step is gated on a tag push. It also now records why hand-publishing is no longer a fallback: under 2FA it prints success while only staging the version.
1 parent a5d59a1 commit 3b2ace3

6 files changed

Lines changed: 113 additions & 45 deletions

File tree

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish
1+
name: Release
22

33
# Publishing is tag-driven on purpose: a human decides the version, the tag
44
# records when, and nothing reaches npm from a working branch.
@@ -9,9 +9,15 @@ name: Publish
99
#
1010
# organization or user : PerryLink
1111
# repository : jevcore
12-
# workflow filename : publish.yml
12+
# workflow filename : release.yml
1313
# environment : (leave empty)
1414
#
15+
# The filename is matched exactly, extension included, so it is load-bearing:
16+
# renaming this file silently breaks the release, and a mismatch shows up as an
17+
# authentication failure rather than as a missing workflow. `release.yml` is also
18+
# what 38 of the sibling plugin repositories call theirs (`publish.yml` appears in
19+
# 7), which is why this file is not named after what it does.
20+
#
1521
# `id-token: write` below is what lets the runner mint the OIDC token that npm
1622
# exchanges for publish rights for these three packages.
1723
#

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ ships, and how much of it a gate checks.
3434
- `files[]` ships `src` and `CHANGELOG.md`, matching the sibling plugins, so a
3535
stack trace from a published package points at readable source.
3636

37+
- **Releases authenticate with OIDC trusted publishing instead of a stored
38+
token.** `publish.yml` becomes `release.yml` — the filename npm's trusted
39+
publisher matches exactly, extension included, and the name 38 of the sibling
40+
plugin repositories use. The workflow holds no credential, takes
41+
`id-token: write`, and publishes with provenance. Hand-publishing is no longer
42+
a fallback: with 2FA on the account it prints `✅ Published` and exits 0 while
43+
only *staging* the version for approval, and the staged version then occupies
44+
that version number while being invisible to `npm stage list` — which is how
45+
0.2.2 was consumed without ever reaching the registry.
46+
3747
### Added
3848

3949
- **`scripts/check-readme-sync.mjs`**, run by `check` and by `prepublishOnly`. It

‎PUBLISHING.md‎

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1414
Run 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

1818
The 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
233258
then 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"
237262
git 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

264286
Then verify by installing from the registry into an empty directory, not by
265287
reading the publish output:

‎packages/core/CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ ships, and how much of it a gate checks.
3434
- `files[]` ships `src` and `CHANGELOG.md`, matching the sibling plugins, so a
3535
stack trace from a published package points at readable source.
3636

37+
- **Releases authenticate with OIDC trusted publishing instead of a stored
38+
token.** `publish.yml` becomes `release.yml` — the filename npm's trusted
39+
publisher matches exactly, extension included, and the name 38 of the sibling
40+
plugin repositories use. The workflow holds no credential, takes
41+
`id-token: write`, and publishes with provenance. Hand-publishing is no longer
42+
a fallback: with 2FA on the account it prints `✅ Published` and exits 0 while
43+
only *staging* the version for approval, and the staged version then occupies
44+
that version number while being invisible to `npm stage list` — which is how
45+
0.2.2 was consumed without ever reaching the registry.
46+
3747
### Added
3848

3949
- **`scripts/check-readme-sync.mjs`**, run by `check` and by `prepublishOnly`. It

‎packages/dsh/CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ ships, and how much of it a gate checks.
3434
- `files[]` ships `src` and `CHANGELOG.md`, matching the sibling plugins, so a
3535
stack trace from a published package points at readable source.
3636

37+
- **Releases authenticate with OIDC trusted publishing instead of a stored
38+
token.** `publish.yml` becomes `release.yml` — the filename npm's trusted
39+
publisher matches exactly, extension included, and the name 38 of the sibling
40+
plugin repositories use. The workflow holds no credential, takes
41+
`id-token: write`, and publishes with provenance. Hand-publishing is no longer
42+
a fallback: with 2FA on the account it prints `✅ Published` and exits 0 while
43+
only *staging* the version for approval, and the staged version then occupies
44+
that version number while being invisible to `npm stage list` — which is how
45+
0.2.2 was consumed without ever reaching the registry.
46+
3747
### Added
3848

3949
- **`scripts/check-readme-sync.mjs`**, run by `check` and by `prepublishOnly`. It

‎packages/mcp/CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ ships, and how much of it a gate checks.
3434
- `files[]` ships `src` and `CHANGELOG.md`, matching the sibling plugins, so a
3535
stack trace from a published package points at readable source.
3636

37+
- **Releases authenticate with OIDC trusted publishing instead of a stored
38+
token.** `publish.yml` becomes `release.yml` — the filename npm's trusted
39+
publisher matches exactly, extension included, and the name 38 of the sibling
40+
plugin repositories use. The workflow holds no credential, takes
41+
`id-token: write`, and publishes with provenance. Hand-publishing is no longer
42+
a fallback: with 2FA on the account it prints `✅ Published` and exits 0 while
43+
only *staging* the version for approval, and the staged version then occupies
44+
that version number while being invisible to `npm stage list` — which is how
45+
0.2.2 was consumed without ever reaching the registry.
46+
3747
### Added
3848

3949
- **`scripts/check-readme-sync.mjs`**, run by `check` and by `prepublishOnly`. It

0 commit comments

Comments
 (0)