From 174efc45e30814a176575bf63c13e56479d3ecdf Mon Sep 17 00:00:00 2001 From: August Cayzer Date: Sun, 29 Nov 2026 22:26:40 +0000 Subject: [PATCH] ci(release): publish prereleases as latest until a stable release --- .github/workflows/release.yml | 8 +++++++- AGENTS.md | 2 +- README.md | 9 +++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bec4b3e..6df240f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,5 +112,11 @@ jobs: echo "@withmarfa/docs-kit@${VERSION} is already on npm, so there is nothing to publish." exit 0 fi - case "${VERSION}" in *-*) tag=alpha ;; *) tag=latest ;; esac + # A prerelease takes `latest` while npm has no stable version, so + # `latest` never points at an older prerelease. + current="$(npm view @withmarfa/docs-kit dist-tags.latest 2>/dev/null || true)" + case "${VERSION}" in + *-*) case "${current}" in ''|*-*) tag=latest ;; *) tag=alpha ;; esac ;; + *) tag=latest ;; + esac npm publish "${RUNNER_TEMP}/pack/${TARBALL}" --access public --tag "${tag}" diff --git a/AGENTS.md b/AGENTS.md index 897e76b..80beee1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -46,7 +46,7 @@ pnpm pack:check # packs the package and reads the tarball ## Release -Push a tag `v` that matches `package.json`. The release workflow builds and tests the package, attaches its tarball to a GitHub release and publishes it to npm through trusted publishing (environment `npm`; no token). A prerelease goes out under the `alpha` tag. A rerun of the publish job skips a version npm already has. Use the smallest version increment that describes compatibility; a version with a hyphen is a prerelease. +Push a tag `v` that matches `package.json`. The release workflow builds and tests the package, attaches its tarball to a GitHub release and publishes it to npm through trusted publishing (environment `npm`; no token). A prerelease goes out under the `latest` tag while npm has no stable version, and under `alpha` after that, so `latest` never names an older prerelease. A rerun of the publish job skips a version npm already has. Use the smallest version increment that describes compatibility; a version with a hyphen is a prerelease. ## Code Review Rules diff --git a/README.md b/README.md index b18e797..236cca2 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,11 @@ optional peer dependency: install it only if your site reports analytics. ## Install -The kit is published as prereleases under the `alpha` tag: +The kit is published as prereleases. Until it has a stable version, each one is +also the `latest` version: ```sh -pnpm add @withmarfa/docs-kit@alpha +pnpm add -E @withmarfa/docs-kit ``` If your site uses pnpm's `minimumReleaseAge`, add `@withmarfa/*` to @@ -567,8 +568,8 @@ Two sites build on the kit, so a breaking change needs a version bump and both sites updated. Pushing a tag `v` that matches `package.json` runs the release workflow. It builds and tests the package, creates a GitHub release with the tarball and publishes that tarball to npm through trusted publishing, with -provenance. A version with a hyphen is a prerelease and is published under the -`alpha` tag. +provenance. A version with a hyphen is a prerelease. It is published under the `latest` +tag while npm has no stable version, and under the `alpha` tag after that. ## License