Skip to content

Commit dc7c27c

Browse files
authored
Improve registry release reliablilty (#1174)
1 parent dee5927 commit dc7c27c

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

.github/workflows/docker-publish.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,19 @@ jobs:
127127
# This step uses the identity token to provision an ephemeral certificate
128128
# against the sigstore community Fulcio instance.
129129
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
130+
131+
- name: Trigger registry publication
132+
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }}
133+
uses: actions/github-script@v7
134+
with:
135+
script: |
136+
await github.rest.repos.createDispatchEvent({
137+
owner: context.repo.owner,
138+
repo: context.repo.repo,
139+
event_type: 'docker-published',
140+
client_payload: {
141+
tag: context.ref.replace('refs/tags/', ''),
142+
sha: context.sha,
143+
image_digest: '${{ steps.build-and-push.outputs.digest }}'
144+
}
145+
});

.github/workflows/registry-releaser.yml

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

33
on:
4-
push:
5-
tags: ["v*"] # Triggers on version tags like v1.0.0
4+
repository_dispatch:
5+
types: [docker-published] # Triggered after Docker image is published
66
workflow_dispatch: # Allow manual triggering
77

88
jobs:
@@ -23,12 +23,35 @@ jobs:
2323

2424
- name: Fetch tags
2525
run: |
26-
if [[ "${{ github.ref_type }}" != "tag" ]]; then
26+
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
27+
echo "Triggered by docker-published event for tag: ${{ github.event.client_payload.tag }}"
28+
elif [[ "${{ github.ref_type }}" != "tag" ]]; then
2729
git fetch --tags
2830
else
2931
echo "Skipping tag fetch - already on tag ${{ github.ref_name }}"
3032
fi
3133
34+
- name: Wait for Docker image
35+
run: |
36+
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
37+
TAG="${{ github.event.client_payload.tag }}"
38+
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
39+
TAG="${{ github.ref_name }}"
40+
else
41+
TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n1)
42+
fi
43+
IMAGE="ghcr.io/github/github-mcp-server:$TAG"
44+
45+
for i in {1..6}; do
46+
if docker manifest inspect "$IMAGE" &>/dev/null; then
47+
echo "✅ Docker image ready: $TAG"
48+
break
49+
fi
50+
[ $i -eq 6 ] && { echo "❌ Timeout waiting for $TAG after 3 minutes"; exit 1; }
51+
echo "⏳ Waiting for Docker image ($i/6)..."
52+
sleep 30
53+
done
54+
3255
- name: Install MCP Publisher
3356
run: |
3457
git clone --quiet https://github.com/modelcontextprotocol/registry publisher-repo
@@ -37,7 +60,10 @@ jobs:
3760
3861
- name: Update server.json version
3962
run: |
40-
if [[ "${{ github.ref_type }}" == "tag" ]]; then
63+
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
64+
TAG_VERSION=$(echo "${{ github.event.client_payload.tag }}" | sed 's/^v//')
65+
echo "Using tag from dispatch: ${{ github.event.client_payload.tag }}"
66+
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
4167
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
4268
else
4369
LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)

0 commit comments

Comments
 (0)