ci(crates-io): make publish idempotent so it can resume after a partial failure - #49
Conversation
…al failure The publish step ran a flat sequence of cargo publish commands. When crates.io rate-limited a new-crate publish partway through, the already- published crates made any re-run fail on duplicate versions. Loop over the crates in dependency order and skip any whose current version is already on crates.io, so the workflow is safe to re-run and resume.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 219f7a5a9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| curl -sf "https://crates.io/api/v1/crates/${crate}/${version}" \ | ||
| -H "User-Agent: tare-ci-publish" >/dev/null 2>&1 |
There was a problem hiding this comment.
Distinguish missing versions from API failures
When crates.io returns 429/5xx or the lookup encounters a network failure—a relevant scenario because this workflow is intended to recover from rate limiting—curl -sf exits nonzero and the if treats that exactly like a 404. The loop then attempts to publish an already-published crate and fails on the duplicate, defeating the promised resumability. As curl --help all documents, --fail fails on HTTP errors generally; capture the status and publish only on 404, while retrying or failing explicitly for other errors.
Useful? React with 👍 / 👎.
The publish step ran a flat sequence of
cargo publishcommands. When crates.io rate-limited a new-crate publish partway through (the Aug 23 v0.2.0 release — tare-tokenize/cache/core/memory/cli published, then tare-proxy hit the new-crate rate limit and tare-mcp never ran), any re-run failed on the already-published crates.This loops over the crates in dependency order and skips any whose current version is already on crates.io, so the workflow is safe to re-run to resume. Once merged, a workflow_dispatch will finish publishing tare-proxy and tare-mcp.