fix: VPS-617 publish MCP to registry (#13) #50
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: build-release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| outputs: | |
| new_version: ${{ steps.bump.outputs.new_version }} | |
| steps: | |
| - name: Repo checkout | |
| uses: actions/checkout@v4 | |
| - name: Bump version and push tag | |
| id: bump | |
| uses: mathieudutour/[email protected] | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| release_branches: main | |
| - name: Release tag | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ steps.bump.outputs.new_tag }} | |
| generateReleaseNotes: true | |
| publish-npmjs: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update NPM | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Publish package | |
| run: npm publish --provenance --access public | |
| release-github: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@hostinger' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Publish package | |
| run: | | |
| sed -i 's+"name": ".*+"name": "@${{ github.repository }}",+gI' ./package.json | |
| npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-mcp: | |
| runs-on: ubuntu-latest | |
| needs: [ release, publish-npmjs ] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| - 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 | |
| chmod +x ./mcp-publisher | |
| - name: Sync version in server.json | |
| run: | | |
| VERSION=${{ needs.release.outputs.new_version }} | |
| jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > tmp && mv tmp server.json | |
| cat server.json | |
| - name: Login to MCP Registry using GitHub OIDC | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish to MCP Registry | |
| run: ./mcp-publisher publish |