From d4aed6d4eae285eae81bdcca01da980af36b6ef9 Mon Sep 17 00:00:00 2001 From: Paul Carleton Date: Thu, 4 Dec 2025 18:18:40 +0000 Subject: [PATCH 1/2] fix: use versioned npm tag for non-main branch releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 911c08bdf..89673834d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 From acff4b828ebe9d68eb60f2d65e9406bddc8601b9 Mon Sep 17 00:00:00 2001 From: Paul Carleton Date: Thu, 4 Dec 2025 18:34:43 +0000 Subject: [PATCH 2/2] fix: use release-X.Y tag format to avoid semver range conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm rejects tags like "v1.23" because they look like semver ranges. Use "release-1.23" format instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89673834d..60144add1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,13 +72,14 @@ jobs: 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) + # Use "release-X.Y" as tag for old branch releases (e.g., "release-1.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` + # Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23` # to get the latest patch on that minor version, and the tag updates if we # release 1.23.2, 1.23.3, etc. + # Note: Can't use "v1.23" because npm rejects tags that look like semver ranges. MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2) - echo "tag=--tag v${MAJOR_MINOR}" >> $GITHUB_OUTPUT + echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT else echo "tag=" >> $GITHUB_OUTPUT fi