Releases use signed Git tags and npm staged publishing. The workflow stages an exact package, but a maintainer must approve that package with two-factor authentication (2FA) before npm makes it public.
Do not create or move a release tag manually. Do not run npm publish from a
workstation.
- Add the release notes to
CHANGELOG.mdonmain, under a heading that names the version bump:## [Unreleased (patch)],## [Unreleased (minor)], or## [Unreleased (major)]. The release workflow renames it to## [X.Y.Z] - YYYY-MM-DD, and those notes become the GitHub release notes. - Push the completed changes and wait for the ordinary
mainbuild to pass. - Confirm that
mainhas not moved to a different commit.
- Open Build & Prepare Release in GitHub Actions.
- Select Run workflow on
main. - Wait for Build & Prepare Release to finish.
- In the tag-bound Stage npm Release workflow, wait for the Stage package on npm job to finish. Leave the workflow running: its Create immutable GitHub release job waits for your npm approval.
build.yml(Build & Prepare Release) reads the version bump from the## [Unreleased (patch|minor|major)]heading inCHANGELOG.mdwhile the test matrix runs, and fails with instructions if that heading is missing, names no bump, or has no notes under it. Once both pass, it bumps the version, renames the heading to## [X.Y.Z] - YYYY-MM-DDwith a new empty## [Unreleased]above it, adds the version's[X.Y.Z]: <url>link definition, pushes a signed release commit and annotated tag, and startspublish.yamlat that tag.photostructure/changelog-release-actiondoes theCHANGELOG.mdwork and the npm wait below.publish.yaml(Stage npm Release) validates the tag, builds and verifies the exact tarball, and stages it withnpm stage publish. npm trusts only this workflow file, by name, to stage the package, so renaming it means changing the package's trusted-publisher settings on npmjs.com.- npm validates a staged package, which takes 5 to 20 minutes, then holds it until a maintainer approves it with 2FA.
- The Create immutable GitHub release job checks npm every 5 minutes, for up to
5 hours 45 minutes.
Any npm error other than "not found" (E404) ends the job early. Once npm
serves the version, it re-verifies the signed tag and creates the immutable
GitHub release. Its notes are the version's
CHANGELOG.mdsection, followed by GitHub's generated notes. GitHub emails the release to the repository's watchers at that moment, so the email always announces a version they can install.
- Open Staged Packages from the npm user menu.
- Confirm the package name, version, file list, metadata, and provenance.
- Confirm that the provenance identifies this repository,
publish.yaml, the release tag, and the signed tag commit. - Approve the staged package with 2FA.
- Confirm that npm lists the version publicly.
- Wait for the Create immutable GitHub release job to finish, then confirm
that the GitHub release exists, is immutable, and has the version's
CHANGELOG.mdsection at the top of its notes.
- If the pre-tag test fails, fix
mainand start a new release run. - If the tag push succeeds but publisher dispatch fails, rerun only the
dispatch job or start
publish.yamlmanually at the existing signed tag. - If the tagged workflow is defective, fix
mainand release a new version. Never move the existing tag. - If the staged contents are wrong, reject the stage and release a new version. The rejected run's Create immutable GitHub release job then runs out of checks and fails without creating a release. Cancel that run, or ignore its failure, and do not re-run it.
- In the two cases above, the release commit has already moved the notes under
## [X.Y.Z] - YYYY-MM-DDinCHANGELOG.md, and the next release run fails until## [Unreleased]names a bump and has notes. Rename that empty heading to## [Unreleased (patch|minor|major)], move the unpublished version's notes under it, leave a line under## [X.Y.Z]saying that version was never published, and then start the new release. - If the Create immutable GitHub release job fails before it creates the
release (its checks ran out before you approved the stage, or
npm viewfailed with an error other than E404), approve the stage if you have not, then use Re-run failed jobs on that Stage npm Release run. GitHub allows re-runs for 30 days. Do not start a new release. - If npm publishes a bad release, deprecate it or publish a corrected version. Never overwrite a published version.