ci(release-crates): skip dispatch when the GitHub release already exists
The publish job already skips crates whose version is on crates.io, so a re-run after a partial publish picks up where it stopped. The dispatch-distributions job had no equivalent guard: a late or duplicate tag-push trigger would re-dispatch release-github.yml (6 binary builds, ~5 min of CI) and release-mcp-registry.yml (republish to the MCP Registry) for a release that's already out. Gate both dispatches behind a check that the GitHub release for the tag exists. If it does, the downstream chain has already run for this version, so dispatch-distributions is a no-op. Co-Authored-By: OndeCode v1.0.3-acp <noreply@ondeinference.com>
Seto Elkahfi committed
Oct 13, 2026 at 20:22 UTC
2a019f2a023a14bccbac0b5314b79b1387c98c73
1 file changed
+31
.github/workflows/release-crates.yml
+31
@@ -171,7 +171,37 @@ jobs:
171
runs-on: ubuntu-latest
172
173
steps:
174
+ # If the GitHub release already exists for this tag, the downstream
175
+ # workflows have already run for this version — either through a
176
+ # prior dispatch from this workflow, or because the tag push trigger
177
+ # fired twice (or after a manual run). Skip dispatch in that case so
178
+ # we don't re-build the six binaries and re-publish the MCP server
179
+ # for a release that's already out.
180
+ - name: Skip if distributions are already up
181
+ id: check
182
+ uses: actions/github-script@v7
183
+ with:
184
+ script: |
185
+ const tag = '${{ needs.verify.outputs.tag }}';
186
+ try {
187
+ await github.rest.repos.getReleaseByTag({
188
+ owner: context.repo.owner,
189
+ repo: context.repo.repo,
190
+ tag: tag,
191
+ });
192
+ core.info(`Release ${tag} already exists, distributions are up.`);
193
+ core.setOutput('already_published', 'true');
194
+ } catch (err) {
195
+ if (err.status === 404) {
196
+ core.info(`Release ${tag} not found, dispatching distributions.`);
197
+ core.setOutput('already_published', 'false');
198
+ } else {
199
+ throw err;
200
+ }
201
+ }
202
+
203
- name: Trigger GitHub release
204
+ if: steps.check.outputs.already_published != 'true'
205
uses: actions/github-script@v7
206
with:
207
script: |
@@ -186,6 +216,7 @@ jobs:
216
})
217
218
- name: Trigger MCP Registry release
219
+ if: steps.check.outputs.already_published != 'true'
220
uses: actions/github-script@v7
221
with:
222
script: |