Make publish step idempotent: skip duplicate version errors
Re-running the workflow after a partial success failed because the first server's version was already published. Treat 'duplicate version' as a no-op so the workflow can be safely re-triggered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Seto Elkahfi committed
Aug 2, 2026 at 17:52 UTC
c795190e5dfbdc8c5f599c231805dcf1f30bb77c
1 file changed
+12
-2
.github/workflows/release-mcp-registry.yml
+12
-2
@@ -158,9 +158,19 @@ jobs:
158
- name: Publish
159
shell: bash
160
run: |
161
- ./mcp-publisher publish
161
+ publish_or_skip() {
162
+ local out
163
+ out="$(./mcp-publisher publish 2>&1)" && { echo "${out}"; return 0; }
164
+ echo "${out}"
165
+ if echo "${out}" | grep -q "duplicate version"; then
166
+ echo "Version already published — skipping."
167
+ return 0
168
+ fi
169
+ return 1
170
+ }
171
+ publish_or_skip
172
cp server-xcrs.json server.json
163
- ./mcp-publisher publish
173
+ publish_or_skip
174
175
- name: Verify the server is listed
176
shell: bash