Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/release-v1x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Publish v1.x releases when a v1.* tag is pushed
# This allows releasing from the v1.x branch without switching GitHub's default branch
#
# Usage:
# git checkout v1.x
# npm version patch # bumps version and creates tag
# git push origin v1.x --tags
#
# The workflow will automatically build, test, and publish to npm.

name: Publish v1.x

on:
push:
tags:
- 'v1.*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- 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
- 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
- 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 }}
Loading