@@ -16,32 +16,47 @@ jobs:
1616 runs-on : ubuntu-latest
1717
1818 steps :
19- - uses : actions/checkout@v4
20- - uses : actions/setup-node@v4
19+ - uses : actions/checkout@v6
20+
21+ - name : Install pnpm
22+ uses : pnpm/action-setup@v4
23+ id : pnpm-install
24+ with :
25+ run_install : false
26+ - uses : actions/setup-node@v6
2127 with :
2228 node-version : 24
23- cache : npm
29+ cache : pnpm
30+ cache-dependency-path : pnpm-lock.yaml
2431
25- - run : npm ci
26- - run : npm run check
27- - run : npm run build
32+ - run : pnpm install
33+ - run : pnpm run check:all
34+ - run : pnpm run build:all
2835
2936 test :
3037 runs-on : ubuntu-latest
3138 strategy :
3239 fail-fast : false
3340 matrix :
34- node-version : [18 , 24]
41+ node-version : [20, 22 , 24]
3542
3643 steps :
37- - uses : actions/checkout@v4
38- - uses : actions/setup-node@v4
44+ - uses : actions/checkout@v6
45+
46+ - name : Install pnpm
47+ uses : pnpm/action-setup@v4
48+ id : pnpm-install
49+ with :
50+ run_install : false
51+ - uses : actions/setup-node@v6
3952 with :
4053 node-version : ${{ matrix.node-version }}
41- cache : npm
54+ cache : pnpm
55+ cache-dependency-path : pnpm-lock.yaml
56+
57+ - run : pnpm install
4258
43- - run : npm ci
44- - run : npm test
59+ - run : pnpm test:all
4560
4661 publish :
4762 runs-on : ubuntu-latest
@@ -55,24 +70,41 @@ jobs:
5570
5671 steps :
5772 - uses : actions/checkout@v4
73+
74+ - name : Install pnpm
75+ uses : pnpm/action-setup@v4
76+ id : pnpm-install
77+ with :
78+ run_install : false
5879 - uses : actions/setup-node@v4
5980 with :
6081 node-version : 24
61- cache : npm
82+ cache : pnpm
83+ cache-dependency-path : pnpm-lock.yaml
6284 registry-url : ' https://registry.npmjs.org'
63-
64- - run : npm ci
85+ - run : pnpm install
6586
6687 - name : Determine npm tag
6788 id : npm-tag
6889 run : |
6990 VERSION=$(node -p "require('./package.json').version")
91+ # Check if this is a beta release
7092 if [[ "$VERSION" == *"-beta"* ]]; then
7193 echo "tag=--tag beta" >> $GITHUB_OUTPUT
94+ # Check if this release is from a non-main branch (patch/maintenance release)
95+ elif [[ "${{ github.event.release.target_commitish }}" != "main" ]]; then
96+ # Use "release-X.Y" as tag for old branch releases (e.g., "release-1.23" for 1.23.x)
97+ # npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3).
98+ # Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23`
99+ # to get the latest patch on that minor version, and the tag updates if we
100+ # release 1.23.2, 1.23.3, etc.
101+ # Note: Can't use "v1.23" because npm rejects tags that look like semver ranges.
102+ MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
103+ echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT
72104 else
73105 echo "tag=" >> $GITHUB_OUTPUT
74106 fi
75107
76- - run : npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
108+ - run : pnpm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
77109 env :
78110 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments