diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 360df71e..db2f3575 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -194,7 +194,11 @@ jobs: *) tag=latest ;; esac fi - npm stage publish "$tarball" --provenance --ignore-scripts --access public --tag "$tag" + # 0.4.1 to 0.12.2 published directly, so a trusted publisher set up in that time may not allow staging. + if ! npm stage publish "$tarball" --provenance --ignore-scripts --access public --tag "$tag"; then + echo "::error::npm refused to stage $name@$version. If it answered E403 or E404, allow npm stage publish in the package's trusted publisher on npmjs.com, then rerun this workflow on the tag." + return 1 + fi } export -f publish_package package_manifests=() diff --git a/AGENTS.md b/AGENTS.md index 8509f16f..24393691 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -294,7 +294,7 @@ How most packages work, so the bullets below don't repeat it: uppt opens a draft `release/vX.Y.Z` PR from conventional commits on `main`, in lockstep for every package matched by `packages/*`. Merging it tags the version and stages each package on npm through OIDC trusted publishing. Each goes live when the maintainer approves it with 2FA on npmjs.com. - Every package is staged, never published directly. pnpm ranks a staged publish above a direct one, and its `trustPolicy: no-downgrade` refuses any version with weaker evidence than an earlier one. comark-annotate, comark-carousel, and comark-zoom began staged, so their direct releases from 0.4.1 to 0.12.2 can't be installed under that policy. `test/npm-trust.test.ts` fails if the workflow publishes directly again. -- A new package needs a trusted publisher on npmjs.com before its first release, with workflow `release.yaml`, environment `npm`, and `npm stage publish` allowed. Leave `npm publish` off. +- A new package needs a trusted publisher on npmjs.com before its first release, with workflow `release.yaml`, environment `npm`, and `npm stage publish` allowed. Leave `npm publish` off. Publishers set up while releases went out directly (0.4.1 to 0.12.2) may not allow staging, so check them with `npm trust list ` before the first staged release; the publish job names the package npm refuses. - The publish job stages in waves of dependency order and lists them in its summary. Approve in that order, so `latest` never names a sibling version npm lacks: comark-ui after its plugins, comark-linter after comark-ui. - The verify job waits up to six hours for the approvals, then fails for any version that is missing or went out without a staged publish. Approve the rest and rerun it. - If staging fails after the tag exists, approve or reject what it staged, then run `gh workflow run release.yaml --repo onmax/comark-ui --ref vX.Y.Z`. It skips versions already on npm.