Repository navigation
ci: fail the crates.io job when publishing actually fails - #30
Merged
Merged
Conversation
The publish step carried continue-on-error: true, so `cargo publish` exiting 101 was reported as a green job. On the v0.4.1 tag it failed with "crate zarr-cast-value@0.4.0 already exists on crates.io index" and nothing surfaced it; an auth or packaging failure would be hidden the same way. Query the crates.io API for the version being released and skip the publish explicitly when it is already on the index, so re-running a tag build stays idempotent while every other failure fails the job. An unexpected HTTP status from the API is also treated as a failure rather than assumed to mean "not published". Authentication now runs only when there is something to publish, so a skipped run no longer mints an unused trusted-publishing token. Assisted-by: ClaudeCode:claude-opus-5
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
The crates.io publish step in
.github/workflows/cd.ymlcarriedcontinue-on-error: true, so a failed publish was reported as a green job. On thev0.4.1tag it failed withand the job still showed success. Only the PyPI job surfaced the same underlying problem. An authentication failure or a packaging error would be swallowed exactly the same way, which is the more dangerous case — a release could silently never happen.
cargo publishhas no--skip-existing, so the version check is done explicitly: query the crates.io API for the version being released, skip the publish when it is already on the index, and let every other failure fail the job. Re-running a tag build stays idempotent without blanket-ignoring the exit code.An unexpected HTTP status from the API fails the step rather than being assumed to mean "not published" — the failure direction there is a loud publish error, not a silent skip.
Authentication is now gated on the same condition, so a skipped run no longer mints an unused trusted-publishing token.
Testing
Not directly exercisable without cutting a tag, so the pieces were verified individually against the live API:
cargo metadata --format-version 1 --no-deps | jq -er ...returns the version fromcore/Cargo.tomlas expected. YAML parses, andzizmorreports no findings on the modified workflow.Note this PR deliberately does not bump the version — that is #33. Merged alone, this change makes the next tag build fail loudly instead of quietly; merged together with #33, the release succeeds.