1+ name : Publish to MCP Registry
2+
3+ on :
4+ push :
5+ tags : ["v*"] # Triggers on version tags like v1.0.0
6+ workflow_dispatch : # Allow manual triggering
7+
8+ jobs :
9+ publish :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ id-token : write # Required for OIDC authentication
13+ contents : read
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v5
18+
19+ - name : Setup Go
20+ uses : actions/setup-go@v6
21+ with :
22+ go-version : " stable"
23+
24+ - name : Fetch tags
25+ run : |
26+ if [[ "${{ github.ref_type }}" != "tag" ]]; then
27+ git fetch --tags
28+ else
29+ echo "Skipping tag fetch - already on tag ${{ github.ref_name }}"
30+ fi
31+
32+ - name : Wait for Docker image
33+ run : |
34+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
35+ TAG="${{ github.ref_name }}"
36+ else
37+ TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n1)
38+ fi
39+ IMAGE="ghcr.io/github/github-mcp-server:$TAG"
40+
41+ for i in {1..10}; do
42+ if docker manifest inspect "$IMAGE" &>/dev/null; then
43+ echo "✅ Docker image ready: $TAG"
44+ break
45+ fi
46+ [ $i -eq 10 ] && { echo "❌ Timeout waiting for $TAG after 5 minutes"; exit 1; }
47+ echo "⏳ Waiting for Docker image ($i/10)..."
48+ sleep 30
49+ done
50+
51+ - name : Install MCP Publisher
52+ run : |
53+ git clone --quiet https://github.com/modelcontextprotocol/registry publisher-repo
54+ cd publisher-repo && make publisher > /dev/null && cd ..
55+ cp publisher-repo/bin/mcp-publisher . && chmod +x mcp-publisher
56+
57+ - name : Update server.json version
58+ run : |
59+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
60+ TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
61+ else
62+ LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
63+ [ -z "$LATEST_TAG" ] && { echo "No release tag found"; exit 1; }
64+ TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
65+ echo "Using latest tag: $LATEST_TAG"
66+ fi
67+ sed -i "s/\${VERSION}/$TAG_VERSION/g" server.json
68+ echo "Version: $TAG_VERSION"
69+
70+ - name : Validate configuration
71+ run : |
72+ python3 -m json.tool server.json > /dev/null && echo "Configuration valid" || exit 1
73+
74+ - name : Display final server.json
75+ run : |
76+ echo "Final server.json contents:"
77+ cat server.json
78+
79+ - name : Login to MCP Registry (OIDC)
80+ run : ./mcp-publisher login github-oidc
81+
82+ - name : Publish to MCP Registry
83+ run : ./mcp-publisher publish
0 commit comments