Publish to MCP Registry #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to MCP Registry | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Sync server.json version with release tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| if [ -z "$VERSION" ] || [ "$VERSION" = "$GITHUB_REF_NAME" ]; then | |
| VERSION=$(node -p "require('./package.json').version") | |
| fi | |
| echo "Publishing version: $VERSION" | |
| node -e " | |
| const fs = require('fs'); | |
| const s = JSON.parse(fs.readFileSync('server.json', 'utf8')); | |
| s.version = '$VERSION'; | |
| for (const p of s.packages || []) p.version = '$VERSION'; | |
| fs.writeFileSync('server.json', JSON.stringify(s, null, 2) + '\n'); | |
| " | |
| cat server.json | |
| - name: Wait for npm package to be available | |
| run: | | |
| VERSION=$(node -p "require('./server.json').version") | |
| echo "Waiting for mcp-design-system-extractor@$VERSION on npm..." | |
| for i in $(seq 1 60); do | |
| if npm view "mcp-design-system-extractor@$VERSION" version 2>/dev/null | grep -q "^$VERSION$"; then | |
| echo "Package available." | |
| exit 0 | |
| fi | |
| echo "Not yet (attempt $i/60), sleeping 10s..." | |
| sleep 10 | |
| done | |
| echo "Timed out waiting for npm package." | |
| exit 1 | |
| - name: Install mcp-publisher | |
| run: | | |
| curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" \ | |
| | tar xz mcp-publisher | |
| chmod +x mcp-publisher | |
| - name: Login to MCP Registry (GitHub OIDC) | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish to MCP Registry | |
| run: ./mcp-publisher publish |