master
yml 85 lines 2.8 KB
Raw
1 name: Update MCP Registry
2 on:
3 release:
4 types: [released]
5 workflow_dispatch:
6
7 concurrency:
8 group: update-mcp-registry-${{ github.ref }}-${{ github.event_name }}
9 cancel-in-progress: true
10
11 permissions:
12 id-token: write
13 contents: read
14
15 jobs:
16 publish-mcp-registry:
17 name: Publish to MCP Registry
18 runs-on: ubuntu-latest
19 steps:
20 - name: Abort if manual run is not on a v* tag
21 if: >
22 github.event_name == 'workflow_dispatch' &&
23 !startsWith(github.ref, 'refs/tags/v')
24 run: |
25 echo "❌ This workflow can only be run manually on a tag starting with 'v'."
26 echo "Ref: ${{ github.ref }}"
27 exit 1
28 - name: Checkout
29 id: checkout
30 uses: actions/checkout@v6
31
32 - name: Update server.json version
33 id: update_version
34 run: |
35 VERSION="$(cat packaging/version)"
36 VERSION="${VERSION#v}"
37 sed -i 's/"version": ".*"/"version": "'"$VERSION"'"/' server.json
38 echo "Updated server.json to version: $VERSION"
39
40 - name: Install mcp-publisher (latest release)
41 id: install_publisher
42 run: |
43 set -euo pipefail
44 OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
45 ARCH="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
46 URL="https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_${OS}_${ARCH}.tar.gz"
47 curl -fsSL "$URL" | tar xz
48 sudo mv mcp-publisher /usr/local/bin/
49 mcp-publisher --version
50
51 - name: Authenticate mcp-publisher
52 id: mcp_auth
53 run: |
54 mcp-publisher login github-oidc
55
56 - name: Validate server.json (dry run)
57 id: validate
58 env:
59 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60 run: mcp-publisher publish server.json --dry-run
61
62 - name: Publish to registry
63 id: publish
64 env:
65 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 run: mcp-publisher publish server.json
67
68 - name: Failure Notification
69 uses: rtCamp/action-slack-notify@v2
70 if: failure()
71 env:
72 SLACK_COLOR: 'danger'
73 SLACK_FOOTER: ''
74 SLACK_ICON_EMOJI: ':github-actions:'
75 SLACK_TITLE: 'Failed to publish to MCP Registry:'
76 SLACK_USERNAME: 'GitHub Actions'
77 SLACK_MESSAGE: |-
78 ${{ github.repository }}: Failed to publish new agent version to MCP Registry.
79 Checkout: ${{ steps.checkout.outcome }}
80 Update version: ${{ steps.update_version.outcome }}
81 Install mcp-publisher: ${{ steps.install_publisher.outcome }}
82 MCP Auth: ${{ steps.mcp_auth.outcome }}
83 Validate: ${{ steps.validate.outcome }}
84 Publish: ${{ steps.publish.outcome }}
85 SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}