v1.23.1 #74
Workflow file for this run
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 MCP Server | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 1.2.3)" | |
| required: true | |
| type: string | |
| npm_tag: | |
| description: "npm dist-tag (e.g., latest, beta)" | |
| required: false | |
| default: latest | |
| type: string | |
| permissions: | |
| contents: write | |
| id-token: write | |
| packages: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10.17.1 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build api-contracts (dependency) | |
| run: pnpm --filter @cronicorn/api-contracts build | |
| - name: Set version | |
| id: version | |
| working-directory: apps/mcp-server | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| RELEASE_TAG="${{ github.event.release.tag_name }}" | |
| VERSION=$(echo "$RELEASE_TAG" | sed -E 's/^(mcp-server-)?v//') | |
| else | |
| VERSION="${{ inputs.version }}" | |
| VERSION="${VERSION#v}" | |
| fi | |
| npm version "$VERSION" --no-git-tag-version --allow-same-version | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "📦 Publishing version: $VERSION" | |
| - name: Build MCP server bundle | |
| run: pnpm --filter @cronicorn/mcp-server build | |
| - name: Verify bundle | |
| working-directory: apps/mcp-server | |
| run: | | |
| echo "🔍 Verifying bundle contents..." | |
| if [ ! -f dist/index.js ]; then | |
| echo "❌ Bundle file dist/index.js not found" | |
| exit 1 | |
| fi | |
| echo "📊 Bundle size:" | |
| ls -lh dist/index.js | |
| echo "✅ Verifying shebang:" | |
| head -1 dist/index.js | |
| echo "✅ Verifying no workspace references:" | |
| if grep -q "@cronicorn/api-contracts" dist/index.js; then | |
| echo "❌ Found workspace reference in bundle" | |
| exit 1 | |
| fi | |
| echo "✅ Verifying api-contracts code is bundled:" | |
| if ! grep -q "CreateJobRequestSchema" dist/index.js; then | |
| echo "❌ api-contracts not bundled" | |
| exit 1 | |
| fi | |
| echo "✅ Bundle verification passed!" | |
| - name: Publish to npm | |
| working-directory: apps/mcp-server | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| if [ "${{ github.event.release.prerelease }}" = "true" ]; then | |
| NPM_TAG="beta" | |
| else | |
| NPM_TAG="latest" | |
| fi | |
| else | |
| NPM_TAG="${{ inputs.npm_tag }}" | |
| fi | |
| echo "📤 Publishing @cronicorn/mcp-server@${{ steps.version.outputs.version }} with tag: $NPM_TAG" | |
| npm publish --access public --tag "$NPM_TAG" --provenance | |
| echo "✅ Published to npm!" | |
| - name: Update server.json version | |
| working-directory: apps/mcp-server | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| echo $(jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json) > server.json | |
| echo "✅ Updated server.json to version $VERSION" | |
| - name: Validate server.json | |
| working-directory: apps/mcp-server | |
| run: npx mcp-registry-validator validate server.json | |
| - name: Install MCP Publisher | |
| working-directory: apps/mcp-server | |
| run: | | |
| curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.4.0/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher | |
| - name: Login to MCP Registry | |
| working-directory: apps/mcp-server | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish to MCP Registry | |
| working-directory: apps/mcp-server | |
| run: ./mcp-publisher publish | |
| - name: Summary | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| NPM_TAG="${{ github.event.release.prerelease == 'true' && 'beta' || 'latest' }}" | |
| TRIGGER="GitHub Release: ${{ github.event.release.tag_name }}" | |
| else | |
| NPM_TAG="${{ inputs.npm_tag }}" | |
| TRIGGER="Manual: v${{ steps.version.outputs.version }}" | |
| fi | |
| echo "## 🎉 MCP Server Published!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Trigger:** $TRIGGER" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**npm tag:** \`$NPM_TAG\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Registries" >> $GITHUB_STEP_SUMMARY | |
| echo "- [npm](https://www.npmjs.com/package/@cronicorn/mcp-server/v/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY | |
| echo "- [MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.weskerllc%2Fcronicorn-mcp-server)" >> $GITHUB_STEP_SUMMARY |