Skip to content

Commit 2a36278

Browse files
committed
fix: trigger MCP Registry publish after PyPI workflow completes
- Changed from tag push trigger to workflow_run (waits for PyPI workflow) - Added PyPI propagation check (polls up to 3 min before publishing) - Prevents race condition where MCP Registry can't find package on PyPI
1 parent fdc791b commit 2a36278

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

.github/workflows/publish-mcp.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
name: Publish to MCP Registry
22

33
on:
4-
push:
5-
tags: ["v*"] # Triggers on version tags like v0.4.0
4+
workflow_run:
5+
workflows: ["Publish to PyPI"]
6+
types: [completed]
67

78
jobs:
89
publish-mcp:
910
runs-on: ubuntu-latest
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1012
permissions:
1113
id-token: write # Required for OIDC authentication
1214
contents: read
1315

1416
steps:
1517
- name: Checkout code
1618
uses: actions/checkout@v5
19+
with:
20+
ref: ${{ github.event.workflow_run.head_branch }}
1721

1822
- name: Install mcp-publisher
1923
run: |
@@ -22,10 +26,28 @@ jobs:
2226
- name: Authenticate to MCP Registry
2327
run: ./mcp-publisher login github-oidc
2428

25-
- name: Set version in server.json
29+
- name: Set version from tag
2630
run: |
27-
VERSION=${GITHUB_REF#refs/tags/v}
31+
TAG="${{ github.event.workflow_run.head_branch }}"
32+
VERSION="${TAG#v}"
33+
echo "Publishing version: $VERSION"
2834
jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.tmp && mv server.tmp server.json
2935
36+
- name: Wait for PyPI propagation
37+
run: |
38+
TAG="${{ github.event.workflow_run.head_branch }}"
39+
VERSION="${TAG#v}"
40+
echo "Waiting for predictive-maintenance-mcp $VERSION on PyPI..."
41+
for i in $(seq 1 12); do
42+
if curl -sf "https://pypi.org/pypi/predictive-maintenance-mcp/$VERSION/json" > /dev/null; then
43+
echo "Package found on PyPI!"
44+
exit 0
45+
fi
46+
echo "Attempt $i/12 - not yet available, waiting 15s..."
47+
sleep 15
48+
done
49+
echo "Package not found on PyPI after 3 minutes"
50+
exit 1
51+
3052
- name: Publish server to MCP Registry
3153
run: ./mcp-publisher publish

0 commit comments

Comments
 (0)