From ceea93f86da31082e26e2b06f101ba3e1d4f4200 Mon Sep 17 00:00:00 2001 From: Felix Weinberger Date: Mon, 23 Feb 2026 23:05:35 +0000 Subject: [PATCH] fix: treat v1.x as primary branch for npm latest tag Releases from v1.x were being published with a release-X.Y npm tag instead of latest, because the workflow only recognized 'main' as the primary branch. This caused npm install @modelcontextprotocol/sdk to resolve to an older version (1.26.0 instead of 1.27.0). Also removes release-v1x.yml which is now redundant and would race with main.yml on v1.x releases. --- .github/workflows/main.yml | 4 +- .github/workflows/release-v1x.yml | 105 ------------------------------ 2 files changed, 2 insertions(+), 107 deletions(-) delete mode 100644 .github/workflows/release-v1x.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73162fba5..8c35bc238 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,8 +91,8 @@ jobs: # 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 + # Check if this release is from a non-primary branch (patch/maintenance release) + elif [[ "${{ github.event.release.target_commitish }}" != "main" && "${{ github.event.release.target_commitish }}" != "v1.x" ]]; then # 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 "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23` diff --git a/.github/workflows/release-v1x.yml b/.github/workflows/release-v1x.yml deleted file mode 100644 index 3bebc9b50..000000000 --- a/.github/workflows/release-v1x.yml +++ /dev/null @@ -1,105 +0,0 @@ -# Publish v1.x releases when a v1.* tag is pushed -# This allows releasing from the v1.x branch without switching GitHub's default branch -# -# Automatic (latest v1.x): -# git checkout v1.x -# npm version patch # bumps version and creates tag -# git push origin v1.x --tags -# -# Manual (for older minor versions like v1.23.x): -# 1. Create a release branch: git checkout -b release/1.23 v1.23.1 -# 2. Apply your fixes -# 3. Bump version: npm version patch # creates v1.23.2 tag -# 4. Push: git push origin release/1.23 --tags -# 5. Run this workflow manually from GitHub Actions, specifying the tag -# -# The workflow will automatically build, test, and publish to npm. - -name: Publish v1.x - -on: - push: - tags: - - 'v1.*' - workflow_dispatch: - inputs: - ref: - description: 'Git ref to release (tag, e.g., v1.23.2)' - required: true - type: string - -permissions: - contents: read - -concurrency: ${{ github.workflow }}-${{ inputs.ref || github.ref }} - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref || github.ref }} - - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - - - run: npm ci - - run: npm run check - - run: npm run build - - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [18, 24] - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref || github.ref }} - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: npm - - - run: npm ci - - run: npm test - - publish: - runs-on: ubuntu-latest - needs: [build, test] - environment: release - - permissions: - contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref || github.ref }} - - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - registry-url: 'https://registry.npmjs.org' - - - run: npm ci - - - name: Determine npm tag - id: npm-tag - run: | - VERSION=$(node -p "require('./package.json').version") - # Use "release-X.Y" as tag for v1.x releases - # This allows users to install specific minor versions: - # npm install @modelcontextprotocol/sdk@release-1.25 - MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2) - echo "tag=release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT - - - run: npm publish --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}