From 3a672561f48506952e7420735f108a40bfa7d8b9 Mon Sep 17 00:00:00 2001 From: Vigneshwer Vaidyanathan Date: Mon, 24 Aug 2026 14:45:54 -0400 Subject: [PATCH 1/2] Derive npm dist-tag from package major in publish workflow publish.yml ran a bare `npm publish`, which always moves the 'latest' dist-tag to whatever version is being published. That is wrong for maintenance releases on an older major: publishing 1.5.1 would have pointed 'latest' at it and pulled every `npm install @fragment-dev/node-client` back to the v1 line. Compare the package major against the current 'latest' major and publish older majors under a 'v' tag instead. --- .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 1e2cf46..45c7526 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -38,6 +38,20 @@ jobs: max_attempts: 2 command: yarn - - run: npm publish --access public + - name: Determine npm dist-tag + id: dist-tag + run: | + VERSION="$(npm pkg get version | tr -d '\"')" + MAJOR="${VERSION%%.*}" + LATEST_MAJOR="$(npm view @fragment-dev/node-client version 2>/dev/null | cut -d. -f1)" + if [ -n "$LATEST_MAJOR" ] && [ "$MAJOR" -lt "$LATEST_MAJOR" ]; then + TAG="v$MAJOR" + else + TAG="latest" + fi + echo "Publishing $VERSION under dist-tag $TAG" + echo "tag=$TAG" >> $GITHUB_OUTPUT + + - run: npm publish --access public --tag ${{ steps.dist-tag.outputs.tag }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 171f3a6c1625d6315600e3167c97d6fd667c28fc Mon Sep 17 00:00:00 2001 From: Vigneshwer Vaidyanathan Date: Thu, 24 Sep 2026 17:06:27 -0400 Subject: [PATCH 2/2] Use a valid dist-tag name for older majors npm rejects dist-tags that parse as SemVer ranges, so the "v$MAJOR" form this branch originally used fails outright: npm error Tag name must not be a valid SemVer range: v1 "v1" parses as ">=1.0.0 <2.0.0". So do "1.x" and "v1.x". Suffixing with "-legacy" keeps the tag readable while remaining a valid tag name, and matches the tag 1.5.0 was published under. Claude-Session: https://claude.ai/code/session_01XAMVwbhshgNFmGj4sL18x7 --- .github/workflows/publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 45c7526..4bc1c23 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,8 +44,11 @@ jobs: VERSION="$(npm pkg get version | tr -d '\"')" MAJOR="${VERSION%%.*}" LATEST_MAJOR="$(npm view @fragment-dev/node-client version 2>/dev/null | cut -d. -f1)" + # npm refuses dist-tags that parse as SemVer ranges, so "v1" is rejected + # outright ("Tag name must not be a valid SemVer range"). The "-legacy" + # suffix keeps the tag readable while staying a valid tag name. if [ -n "$LATEST_MAJOR" ] && [ "$MAJOR" -lt "$LATEST_MAJOR" ]; then - TAG="v$MAJOR" + TAG="v${MAJOR}-legacy" else TAG="latest" fi