fix(ci): decouple tweet from crates.io and fix duplicate publish handling (#3716)

Drop crates-io from the tweet job's needs so the release announcement
goes out with GitHub release, Docker, and website — not blocked by
crates.io publish timing.

Also fix the duplicate detection: the previous curl-based check used
a URL that didn't match the actual crate, causing cargo publish to
hit "already exists" and fail the whole job. Now we just run cargo
publish and treat "already exists" as success.
This commit is contained in:
Argenis 2026-03-16 13:46:05 -04:00 committed by Roman Tataurov
parent 20e012a564
commit a809ad7598
No known key found for this signature in database
GPG Key ID: 70A51EF3185C334B

View File

@ -307,13 +307,16 @@ jobs:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VERSION: ${{ inputs.version }}
run: |
# Skip if this version is already on crates.io (auto-sync may have published it)
# Publish to crates.io; treat "already exists" as success
# (auto-publish workflow may have already published this version)
CRATE_NAME=$(sed -n 's/^name = "\([^"]*\)"/\1/p' Cargo.toml | head -1)
if curl -sfL "https://crates.io/api/v1/crates/${CRATE_NAME}/${VERSION}" | grep -q '"version"'; then
echo "::notice::${CRATE_NAME}@${VERSION} already published on crates.io — skipping"
else
cargo publish --locked --allow-dirty --no-verify
OUTPUT=$(cargo publish --locked --allow-dirty --no-verify 2>&1) && exit 0
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'already exists'; then
echo "::notice::${CRATE_NAME}@${VERSION} already on crates.io — skipping"
exit 0
fi
exit 1
redeploy-website:
name: Trigger Website Redeploy
@ -361,7 +364,7 @@ jobs:
# ── Post-publish: only run after ALL artifacts are live ──────────────
tweet:
name: Tweet Release
needs: [validate, publish, docker, crates-io, redeploy-website]
needs: [validate, publish, docker, redeploy-website]
uses: ./.github/workflows/tweet-release.yml
with:
release_tag: ${{ needs.validate.outputs.tag }}