From 4d090059736f9bf4589c45b6f5e58bda34925a56 Mon Sep 17 00:00:00 2001 From: "Andrew (shixish)" Date: Wed, 18 Nov 2026 12:23:58 -1000 Subject: [PATCH] ci(release): point npm next dist-tag at final releases Keeps next from falling behind latest. Uses OIDC trusted publishing for npm dist-tag; warns instead of failing if the permission is not enabled. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14b98a3..47948db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,6 +173,26 @@ jobs: echo "Publishing ${name}@${VERSION} with dist-tag ${dist_tag} via npm trusted publishing." npm publish --access public --provenance --tag "$dist_tag" + # A final release also moves `next`, so `next` is never behind `latest`. + # Uses npm trusted publishing (OIDC) for `npm dist-tag`, which needs npm + # >= 11.21.0 / 12.2.0 and "Allow npm dist-tag" enabled on this package's + # trusted publisher at npmjs.com (off by default). The version is already + # published at this point, so a failure only warns and never fails the run. + - name: Point next at final release + if: github.event_name == 'push' && github.ref_type == 'tag' + run: | + set -uo pipefail + name=$(node -p 'require("./package.json").name') + version=$(node -p 'require("./package.json").version') + case "$version" in + *-*) echo "Prerelease ${version}: next was set by publish."; exit 0 ;; + esac + if npm dist-tag add "${name}@${version}" next; then + echo "next -> ${name}@${version}" + else + echo "::warning::Could not point next at ${name}@${version}. Enable 'Allow npm dist-tag' on the trusted publisher for ${name} at npmjs.com, or run: npm dist-tag add ${name}@${version} next" + fi + release: name: Publish GitHub Release needs: [verify, publish]