From fa366c74bbe19cf96aec6eac51b411c1a7e590da Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 13 May 2026 00:17:28 +0100 Subject: [PATCH] Publish prereleases with matching npm dist-tags --- .github/workflows/publish.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0855681a2..abc0044c2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -82,5 +82,19 @@ jobs: package-manager-cache: false registry-url: https://registry.npmjs.org + - name: Resolve npm dist-tag + run: | + RELEASE_VERSION=${GITHUB_REF#refs/*/} + PACKAGE_VERSION=${RELEASE_VERSION#v} + + case "$PACKAGE_VERSION" in + *-alpha.*) NPM_TAG=alpha ;; + *-beta.*) NPM_TAG=beta ;; + *-rc.*) NPM_TAG=rc ;; + *) NPM_TAG=latest ;; + esac + + echo "NPM_TAG=$NPM_TAG" >> "$GITHUB_ENV" + - name: Publish new version - run: npm publish ./*.tgz --access public --tag=latest + run: npm publish ./*.tgz --access public --tag="$NPM_TAG"