Skip to content

Commit d5dba54

Browse files
pcarletonclaudefelixweinberger
authored
fix: use versioned npm tag for non-main branch releases (#1236)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
1 parent e7ab32f commit d5dba54

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,19 @@ jobs:
6767
id: npm-tag
6868
run: |
6969
VERSION=$(node -p "require('./package.json').version")
70+
# Check if this is a beta release
7071
if [[ "$VERSION" == *"-beta"* ]]; then
7172
echo "tag=--tag beta" >> $GITHUB_OUTPUT
73+
# Check if this release is from a non-main branch (patch/maintenance release)
74+
elif [[ "${{ github.event.release.target_commitish }}" != "main" ]]; then
75+
# Use "release-X.Y" as tag for old branch releases (e.g., "release-1.23" for 1.23.x)
76+
# npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3).
77+
# Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23`
78+
# to get the latest patch on that minor version, and the tag updates if we
79+
# release 1.23.2, 1.23.3, etc.
80+
# Note: Can't use "v1.23" because npm rejects tags that look like semver ranges.
81+
MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
82+
echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT
7283
else
7384
echo "tag=" >> $GITHUB_OUTPUT
7485
fi

0 commit comments

Comments
 (0)