Skip to content

Release through a stage-only trusted publisher, with a checklist - #4

Merged
nedtwigg merged 1 commit into
mainfrom
trusted-publishing
Dec 2, 2026
Merged

nedtwigg merged 1 commit into
mainfrom
trusted-publishing

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Dec 2, 2026

Copy link
Copy Markdown
Member

Replaces the token-based Publish workflow with the pattern diffplug/pgstencil already uses: the workflow can only stage a release, and a person approves it with 2FA. Adds RELEASING.md, the release checklist.

Why

The Publish workflow from #1 needed a stored NPM_TOKEN. npm is restricting tokens that bypass 2FA, and a stored token that can publish is exactly what an attacker wants. With a stage-only trusted publisher there is no token, and a stolen workflow can stage a version but cannot make it public.

What changes

  • .github/workflows/release.yml (new), adapted from pgstencil's:
    • On a push to main, it finds each of the three versions npm does not have. They must share one version.
    • If any is missing, the stage job runs in the publish environment: it installs, runs pnpm test, packs each package with pnpm, and runs npm stage publish on the archive.
    • pnpm packs because it writes each workspace:* dependency as the version it names.
    • On an ordinary push, every version is already on npm, so the stage job is skipped.
  • .github/workflows/publish.yml is deleted.
  • RELEASING.md (new): the seven-step checklist, from the version pull request through approval, the tag, the site check, and moving Dormouse's pin. It also records how publishing is locked down.

One difference from pgstencil: that workflow waits for its security-audit check before staging. This repository has no such check, so the stage job runs the tests itself.

Setup this needs before the next release

None of it exists yet. RELEASING.md describes the end state.

  1. GitHub: an environment named publish on this repository, limited to the main branch.
  2. npmjs.com, for each of the three packages: Settings → Trusted publisher → GitHub Actions, with organization diffplug, repository dor-tools, workflow release.yml, environment publish, and "can also publish directly with npm publish" left unchecked.
  3. npmjs.com, for each package: Publishing access set to require 2FA and disallow tokens.

Verified

  • actionlint passes on release.yml.
  • pnpm's pack names match what the workflow expects (dor-tools-api-<version>.tgz and so on); seen when packing 0.1.0.
  • RELEASING.md follows Dormouse's one-paragraph-per-line rule, which its lint applies to this repository through the submodule.

Not verified

  • The stage job has never run. It runs only when a version is missing from npm, so its first real test is the next release. Until then every push exercises the plan job alone.
  • npm stage publish on an archive packed by pnpm. pgstencil stages archives its own script packs.

🤖 Generated with Claude Code

Replaces the Publish workflow, which needed a stored NPM_TOKEN. npm is
restricting tokens that bypass 2FA, and a token that can publish is the
thing worth stealing.

release.yml stages any version npm does not have, through npm's trusted
publisher for this repository. A staged package is not public until a
maintainer approves it with 2FA. RELEASING.md is the checklist.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying dor-tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a5f469
Status: ✅  Deploy successful!
Preview URL: https://03e810f7.dor-tools.pages.dev
Branch Preview URL: https://trusted-publishing.dor-tools.pages.dev

View logs

@nedtwigg
nedtwigg merged commit 7fa0a8b into main Dec 2, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant