Skip to content

Release 0.1.1: make the package listable in the MCP Registry #2

Release 0.1.1: make the package listable in the MCP Registry

Release 0.1.1: make the package listable in the MCP Registry #2

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
# Makes a re-run safe: a version already on npm can never be republished,
# so the job would otherwise fail on the second attempt.
- name: Check whether this version is already on npm
id: published
shell: bash
run: |
name="$(node -p "require('./package.json').name")"
version="$(node -p "require('./package.json').version")"
if npm view "$name@$version" version >/dev/null 2>&1; then
echo "already=true" >> "$GITHUB_OUTPUT"
echo "$name@$version is already on npm — skipping publish."
else
echo "already=false" >> "$GITHUB_OUTPUT"
echo "$name@$version is not on npm yet."
fi
- name: Publish
if: steps.published.outputs.already == 'false'
shell: bash
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NPM_TOKEN is not configured, so this release cannot be published."
echo "Repository secrets are not shared between repositories, so a token set on"
echo "another deckflow repo does not apply here. Create an Automation token at"
echo "npmjs.com and add it with:"
echo " gh secret set NPM_TOKEN -R ${{ github.repository }}"
exit 1
fi
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