Skip to content

Commit b2bc6ea

Browse files
committed
ci: gracefully handle crates.io 'already exists' error
1 parent 6391523 commit b2bc6ea

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ jobs:
133133
- name: Publish to crates.io
134134
env:
135135
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
136-
run: cargo publish --no-verify
136+
run: |
137+
cargo publish --no-verify 2>&1 | tee publish_output.txt || {
138+
if grep -q "already exists" publish_output.txt; then
139+
echo "Version already published to crates.io, skipping"
140+
exit 0
141+
else
142+
exit 1
143+
fi
144+
}
137145
138146
publish-npm:
139147
name: Publish to npm

0 commit comments

Comments
 (0)