|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Publishes to npm and the official MCP Registry when a version tag (vX.Y.Z) is pushed. |
| 4 | +# |
| 5 | +# Credentials: |
| 6 | +# - npm: NO token. Uses npm Trusted Publishing (OIDC). Configure a trusted |
| 7 | +# publisher on the @noteboxd/mcp package (npmjs.com -> package -> Settings -> |
| 8 | +# Trusted Publishers) bound to this repo + workflow file "release.yml". |
| 9 | +# - MCP Registry: the DNS namespace (com.noteboxd) is authenticated with the |
| 10 | +# ed25519 key behind the noteboxd.com TXT record, provided as the |
| 11 | +# MCP_DNS_PRIVATE_KEY secret (its repository access must include this repo). |
| 12 | +# |
| 13 | +# Cut a release: |
| 14 | +# 1. Bump the version in package.json, server.json, and src/config.ts (keep equal). |
| 15 | +# 2. git commit + git tag vX.Y.Z + git push --follow-tags |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + tags: |
| 20 | + - "v*" |
| 21 | + |
| 22 | +jobs: |
| 23 | + release: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + id-token: write # required for npm Trusted Publishing (OIDC) |
| 27 | + contents: read |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: "22" |
| 34 | + registry-url: "https://registry.npmjs.org" |
| 35 | + |
| 36 | + - name: Verify tag matches package.json and server.json versions |
| 37 | + run: | |
| 38 | + TAG="${GITHUB_REF_NAME#v}" |
| 39 | + PKG="$(node -p "require('./package.json').version")" |
| 40 | + SRV="$(node -p "require('./server.json').version")" |
| 41 | + if [ "$TAG" != "$PKG" ] || [ "$TAG" != "$SRV" ]; then |
| 42 | + echo "Version mismatch: tag=$TAG package.json=$PKG server.json=$SRV" |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Install dependencies |
| 47 | + run: npm install |
| 48 | + |
| 49 | + - name: Upgrade npm (Trusted Publishing requires npm >= 11.5) |
| 50 | + run: npm install -g npm@latest |
| 51 | + |
| 52 | + - name: Publish to npm (OIDC, no token) |
| 53 | + run: npm publish |
| 54 | + |
| 55 | + - name: Install mcp-publisher |
| 56 | + run: | |
| 57 | + curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher |
| 58 | + sudo mv mcp-publisher /usr/local/bin/ |
| 59 | +
|
| 60 | + - name: Publish to MCP Registry (DNS auth) |
| 61 | + env: |
| 62 | + MCP_DNS_PRIVATE_KEY: ${{ secrets.MCP_DNS_PRIVATE_KEY }} |
| 63 | + run: | |
| 64 | + mcp-publisher login dns --domain noteboxd.com --private-key "$MCP_DNS_PRIVATE_KEY" |
| 65 | + mcp-publisher publish |
0 commit comments