Publish to MCP Registry #13
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 1.0.1)" | |
| required: true | |
| type: string | |
| env: | |
| REGISTRY: docker.io | |
| IMAGE_NAME: kdaniel/bgg-mcp | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write # Required for OIDC authentication | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| cache: true | |
| - name: Build and verify | |
| run: | | |
| go mod download | |
| go build -o bgg-mcp main.go | |
| echo "✓ Build successful" | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: kdaniel | |
| password: ${{ secrets.DOCKER_ACC }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=tag | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Update server.json version | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| if [ -z "$VERSION" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| fi | |
| jq --arg version "$VERSION" '.version = $version | .packages[0].version = $version' server.json > server.json.tmp | |
| mv server.json.tmp server.json | |
| echo "Updated server.json to version $VERSION" | |
| - name: Validate server.json | |
| run: | | |
| chmod +x validate_server.sh | |
| ./validate_server.sh | |
| - name: Install MCP Publisher | |
| run: | | |
| curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_$(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 | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish to MCP Registry | |
| run: | | |
| ./mcp-publisher publish | |
| echo "✓ Successfully published to MCP Registry" | |
| echo "✓ Docker image published to: docker.io/kdaniel/bgg-mcp:${{ steps.meta.outputs.version }}" | |
| echo "" | |
| echo "Create a GitHub release manually with your release notes at:" | |
| echo "https://github.com/kkjdaniel/bgg-mcp/releases/new?tag=${{ github.ref_name }}" |