Skip to content

Check server.json versions against the release tag too #1

Check server.json versions against the release tag too

Check server.json versions against the release tag too #1

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
# Required for npm provenance, which records how the artifact was built.
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "22"
registry-url: https://registry.npmjs.org
cache: npm
- run: npm ci
- name: Verify the tag matches every declared version
shell: bash
run: |
tag="${GITHUB_REF_NAME#v}"
manifest="$(node -p "require('./package.json').version")"
server="$(node -p "require('./server.json').version")"
package="$(node -p "require('./server.json').packages[0].version")"
mismatch=0
for pair in "package.json:$manifest" "server.json:$server" "server.json/packages[0]:$package"; do
if [ "${pair#*:}" != "$tag" ]; then
echo "${pair%%:*} declares ${pair#*:}, but the tag is $tag" >&2
mismatch=1
fi
done
exit "$mismatch"
- name: Test
run: npm test
- name: Publish
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
registry:
name: Publish to the MCP Registry
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- name: Install the registry publisher
run: |
curl -sSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.tar.gz" \
| tar xz mcp-publisher
- name: Authenticate and publish
run: |
./mcp-publisher login github-oidc
./mcp-publisher publish