From 0eae24218d4a4118369883d59240be47a8ba1f60 Mon Sep 17 00:00:00 2001 From: Randolf Jung Date: Tue, 24 Feb 2026 12:21:41 -0800 Subject: [PATCH] fix: make crate publish idempotent when version already exists Gracefully skip publishing crates that are already on crates.io, allowing the workflow to be re-run after partial failures. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54da795..088ecfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -277,7 +277,14 @@ jobs: for crate in "${CRATES[@]}"; do echo "Publishing $crate..." - cargo publish --locked -p "$crate" + output=$(cargo publish --locked -p "$crate" 2>&1) && echo "$output" || { + if echo "$output" | grep -q "already exists on crates.io index"; then + echo "$crate already published, skipping." + else + echo "$output" >&2 + exit 1 + fi + } # Wait for crates.io index to update before publishing # dependents (skip delay after the last crate).