Skip to content

Commit 61567a6

Browse files
committed
feat(release): publish nightly and stable releases through npm trusted publishing
.github/workflows/release.yml owns every npm publish. A schedule publishes main's HEAD under the nightly dist-tag once CI passed; dispatching stable promotes the latest nightly's commit to X.Y.Z, then publishes the GitHub release, its assets, and the MCP Registry entry, and moves main to the next -dev version. Only the publish job can mint an id-token, and no npm token is involved.
1 parent 652160e commit 61567a6

12 files changed

Lines changed: 912 additions & 41 deletions

‎.github/actions/setup-node-pnpm/action.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
description: 'Whether to install dependencies with pnpm install --frozen-lockfile'
1111
required: false
1212
default: 'true'
13+
cache-store:
14+
description: 'Whether installing dependencies may restore and save the pnpm store cache'
15+
required: false
16+
default: 'true'
1317
cache-dependency-path:
1418
description: 'Lockfile path(s) used to key the pnpm store cache'
1519
required: false
@@ -48,7 +52,7 @@ runs:
4852
# Only cache the pnpm store when this action also installs dependencies.
4953
# Jobs with install-deps: false never create the store, and on a cache
5054
# miss (any lockfile-changing PR) the post-job cache save fails the job.
51-
cache: ${{ inputs.install-deps == 'true' && 'pnpm' || '' }}
55+
cache: ${{ inputs.install-deps == 'true' && inputs.cache-store == 'true' && 'pnpm' || '' }}
5256
cache-dependency-path: ${{ inputs.cache-dependency-path }}
5357

5458
# Corepack resolves the same `packageManager` field locally, so a mismatch

‎.github/workflows/publish-mcp-registry.yml‎

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Publish MCP Registry
22

33
on:
4-
release:
5-
types:
6-
- published
4+
# release.yml calls this after publishing a stable release; dispatch reruns it for one tag.
5+
workflow_call:
6+
inputs:
7+
release_tag:
8+
description: GitHub Release tag to publish metadata for, for example v0.16.5.
9+
required: true
10+
type: string
711
workflow_dispatch:
812
inputs:
913
release_tag:
@@ -32,30 +36,21 @@ jobs:
3236
- name: Checkout
3337
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3438
with:
35-
ref: ${{ github.event.inputs.checkout_ref || github.ref }}
39+
ref: ${{ inputs.checkout_ref || github.ref }}
3640

3741
- name: Setup Node.js
3842
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
3943
with:
4044
node-version: '24.13'
4145

42-
- name: Resolve release metadata
43-
id: meta
46+
# A released commit carries main's -dev version; stamp the tag's version into
47+
# package.json and server.json before publishing the metadata.
48+
- name: Stamp release version
49+
env:
50+
RELEASE_TAG: ${{ inputs.release_tag }}
4451
run: |
45-
set -euo pipefail
46-
PACKAGE_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
47-
SERVER_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('server.json', 'utf8')).version")"
48-
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.release_tag }}"
49-
VERSION="${TAG_NAME#v}"
50-
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
51-
echo "Release tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
52-
exit 1
53-
fi
54-
if [ "$VERSION" != "$SERVER_VERSION" ]; then
55-
echo "Release tag $TAG_NAME does not match server.json version $SERVER_VERSION" >&2
56-
exit 1
57-
fi
58-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
52+
npm pkg set "version=${RELEASE_TAG#v}"
53+
node scripts/sync-mcp-metadata.mjs
5954
shell: bash
6055

6156
# This job provisions pnpm via plain actions/setup-node, not the repo's

‎.github/workflows/release-android-snapshot-helper.yml‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Release Android Snapshot Helper
22

33
on:
4-
release:
5-
types:
6-
- published
4+
# release.yml calls this after publishing a stable release; dispatch reruns it for one tag.
5+
workflow_call:
6+
inputs:
7+
release_tag:
8+
description: GitHub Release tag to upload assets to, for example v0.13.3.
9+
required: true
10+
type: string
711
workflow_dispatch:
812
inputs:
913
release_tag:
@@ -30,7 +34,7 @@ jobs:
3034
- name: Checkout
3135
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3236
with:
33-
ref: ${{ github.event.inputs.checkout_ref || github.ref }}
37+
ref: ${{ inputs.checkout_ref || github.ref }}
3438

3539
- name: Setup Node.js
3640
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
@@ -60,13 +64,8 @@ jobs:
6064
id: meta
6165
run: |
6266
set -euo pipefail
63-
PACKAGE_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
64-
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.release_tag }}"
67+
TAG_NAME="${{ inputs.release_tag }}"
6568
VERSION="${TAG_NAME#v}"
66-
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
67-
echo "Release tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
68-
exit 1
69-
fi
7069
echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT"
7170
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
7271
shell: bash

‎.github/workflows/release-ios-runner.yml‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Release iOS Runner
22

33
on:
4-
release:
5-
types:
6-
- published
4+
# release.yml calls this after publishing a stable release; dispatch reruns it for one tag.
5+
workflow_call:
6+
inputs:
7+
release_tag:
8+
description: GitHub Release tag to upload assets to, for example v0.12.6.
9+
required: true
10+
type: string
711
workflow_dispatch:
812
inputs:
913
release_tag:
@@ -31,7 +35,7 @@ jobs:
3135
- name: Checkout
3236
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3337
with:
34-
ref: ${{ github.event.inputs.checkout_ref || github.ref }}
38+
ref: ${{ inputs.checkout_ref || github.ref }}
3539

3640
- name: Setup toolchain
3741
uses: ./.github/actions/setup-node-pnpm
@@ -42,13 +46,8 @@ jobs:
4246
id: meta
4347
run: |
4448
set -euo pipefail
45-
PACKAGE_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
46-
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.release_tag }}"
49+
TAG_NAME="${{ inputs.release_tag }}"
4750
VERSION="${TAG_NAME#v}"
48-
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
49-
echo "Release tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
50-
exit 1
51-
fi
5251
echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT"
5352
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
5453
shell: bash

0 commit comments

Comments
 (0)