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 : Install jq
20
+ run : sudo apt-get update && sudo apt-get install -y jq
21
+
22
+ - name : Install MCP Publisher
23
+ run : |
24
+ 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
25
+
26
+ - name : Update server.json version
27
+ run : |
28
+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
29
+ # Use the tag that triggered the workflow
30
+ TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
31
+ echo "Using triggered tag: ${{ github.ref_name }}"
32
+ else
33
+ # Fallback to latest tag (for manual triggers)
34
+ LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
35
+ if [ -z "$LATEST_TAG" ]; then
36
+ echo "❌ No release tag found. Cannot determine version."
37
+ exit 1
38
+ fi
39
+ TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
40
+ echo "Using latest tag: $LATEST_TAG"
41
+ fi
42
+ jq ".version = \"$TAG_VERSION\" | .packages[].version = \"$TAG_VERSION\"" server.json > server.json.tmp && mv server.json.tmp server.json
43
+ echo "Updated server.json version to $TAG_VERSION"
44
+
45
+ - name : Login to MCP Registry
46
+ run : ./mcp-publisher login github-oidc
47
+
48
+ - name : Publish to MCP Registry
49
+ run : ./mcp-publisher publish
0 commit comments