Skip to content

Publish to npm

Publish to npm #5

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- name: Set up Node 22
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Publish to npm
# Node 22 ships npm 10.x; Trusted Publisher OIDC token exchange
# needs npm >= 11.5.1, so invoke latest npm via npx just for this step.
run: npx --yes npm@latest publish --provenance --access public
- name: Install mcp-publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
- name: Authenticate to MCP Registry (GitHub OIDC)
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish