Skip to content

Commit 41d6c31

Browse files
committed
fix(ci): use version-specific npm tag for version branches
Version branches like v1.4.x now publish with a version-based npm tag (e.g., `1.4`) instead of `latest`, so they don't override the current main release.
1 parent 4e7cf20 commit 41d6c31

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.claude/rules/release.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ The release workflow will publish to npm with the `beta` tag.
4949

5050
For maintaining older versions (e.g., v1.3.x while v1.4.x is latest):
5151

52-
1. Create a version branch named `v1.3.x-latest`
53-
2. Tags pushed from this branch will also receive the `latest` npm tag
52+
1. Create a version branch named `v1.3.x` (or `v1.4.x`, etc.)
53+
2. Tags pushed from this branch will receive the version as the npm tag
54+
(e.g., `v1.4.x` publishes with tag `1.4`)
5455

5556
## Notes
5657

@@ -66,5 +67,5 @@ For maintaining older versions (e.g., v1.3.x while v1.4.x is latest):
6667
* All releases are triggered by pushing tags matching `v*`
6768
* The CI determines the npm tag based on:
6869
* Pre-release suffix in tag name (canary, beta, rc, next)
69-
* Whether the commit is on `main` or a version branch (`v*.*.x-latest`)
70+
* Whether the commit is on `main` or a version branch (`v*.*.x`)
7071
* Always ensure CI is green before creating release tags

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ jobs:
5555
else
5656
# Check if the commit is on the main branch or a version branch
5757
git fetch origin main
58-
CURRENT_BRANCH=$(git branch -r --contains "$GITHUB_SHA" | grep -E 'origin/(main|v[0-9]+\.[0-9]+\.x-latest)' | head -1 | sed 's/.*origin\///')
58+
CURRENT_BRANCH=$(git branch -r --contains "$GITHUB_SHA" | grep -E 'origin/(main|v[0-9]+\.[0-9]+\.x)' | head -1 | sed 's/.*origin\///')
5959
6060
if [[ "$CURRENT_BRANCH" == "main" ]]; then
6161
NPM_TAG="latest"
62-
elif [[ "$CURRENT_BRANCH" =~ ^v[0-9]+\.[0-9]+\.x-latest$ ]]; then
63-
# For version branches like v1.3.x-latest, v1.4.x-latest, use "latest" tag
64-
NPM_TAG="latest"
62+
elif [[ "$CURRENT_BRANCH" =~ ^v([0-9]+\.[0-9]+)\.x$ ]]; then
63+
# For version branches like v1.3.x, v1.4.x, use the version as npm tag
64+
NPM_TAG="${BASH_REMATCH[1]}"
6565
else
66-
echo "The tagged commit is not on the main branch or a version branch (v*.*.x-latest)."
67-
echo "::error ::Releases with the 'latest' npm tag must be on the main branch or a version branch."
66+
echo "The tagged commit is not on the main branch or a version branch (v*.*.x)."
67+
echo "::error ::Releases must be on the main branch or a version branch (v*.*.x)."
6868
exit 1
6969
fi
7070
fi

0 commit comments

Comments
 (0)