fix: use versioned npm tag for non-main branch releases
When publishing from maintenance branches (e.g., patch-1), use a major.minor tag like "v1.23" instead of defaulting to "latest". This prevents old patches from becoming the latest version on npm. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e98eece19c
commit
0224934384
1 changed files with 10 additions and 0 deletions
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
|
|
@ -67,8 +67,18 @@ jobs:
|
|||
id: npm-tag
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
# Check if this is a beta release
|
||||
if [[ "$VERSION" == *"-beta"* ]]; then
|
||||
echo "tag=--tag beta" >> $GITHUB_OUTPUT
|
||||
# Check if this release is from a non-main branch (patch/maintenance release)
|
||||
elif [[ "${{ github.event.release.target_commitish }}" != "main" ]]; then
|
||||
# Use major.minor as tag for old branch releases (e.g., "v1.23" for 1.23.x)
|
||||
# npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3).
|
||||
# Using "v1.23" means users can `npm install @modelcontextprotocol/sdk@v1.23`
|
||||
# to get the latest patch on that minor version, and the tag updates if we
|
||||
# release 1.23.2, 1.23.3, etc.
|
||||
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
|
||||
echo "tag=--tag v${MAJOR_MINOR}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "tag=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue