fix(ci): skip crates.io package/publish while the crate is unpublishable - #160
Conversation
Run 33327821333 failed in the "Package crate" step: `cargo package --locked` (no `-p`) packages every workspace default-member, including `api/`, whose `tinycortex-api` depends on `tinymemory-api` by git rev with no `version` key -- cargo refuses to package any crate whose dependency graph has an unpublished git/path dependency without a version requirement. Scoping to `-p tinycortex` alone doesn't fix it either: both `tinycortex` and `tinycortex-api` are already marked `publish = false` in their Cargo.toml, precisely because this same git dependency makes crates.io publishing impossible right now (tracked as tinymemory#18 section A1). This is a known, documented, pre-existing state, not a regression -- this was simply the first release run ever triggered against it. Add a "Check crates.io publishability" step that reads the resolved `publish` field for $CRATE_NAME via `cargo metadata` and skips the "Package crate" / "Publish to crates.io" steps when it is `[]` (publish = false), while still completing the version bump, tag, and push. This also stops packaging from failing on an unrelated workspace member (`api/`) that was never meant to be published by this workflow, by scoping both cargo invocations to `-p "$CRATE_NAME"`. Verified locally: `cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="tinycortex") | .publish'` returns `[]`, matching the skip condition; `cargo package -p tinycortex-api --locked` and `cargo package -p tinycortex --locked` reproduce the exact CI failure locally, confirming the root cause. Ref: https://github.com/tinyhumansai/tinycortex/actions/runs/33327821333 Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
Warning Review limit reached
On-demand reviews are free for the next 21 days. After that, they cost $0.25 per reviewed file. Or wait 35 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Warning Your free Security trial is over. An organization admin can activate Security or dismiss this notice. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Release run 33327821333 (
gh workflow run release.yml --ref main -f bump=patch) failed in the Package crate step:Root cause
cargo package --locked(no-p) packages every workspace default-member —[".", "api"]perCargo.toml— so it also tries to packageapi/.api/Cargo.toml'stinymemory-apidependency is a baregitreference with noversionkey, and cargo refuses to package anything whose dependency graph contains an unpublished git/path dependency without a version requirement.-p tinycortexalone doesn't fix it either — I reproduced that locally too (cargo package -p tinycortex --locked→no matching package named 'tinycortex-api' found). Bothtinycortexandtinycortex-apialready carrypublish = falsein theirCargo.tomls, exactly because this same git dependency (tinymemory-api, tracked as tinymemory#18 §A1) makes crates.io publishing genuinely impossible right now — this is documented, pre-existing, and deliberate, not a regression. This was simply the first release run ever triggered against this workflow, so it had never been exercised end-to-end.tinyagentsrelease failure (which failed earlier, in "Compute next version", because a workspace-inherited version wasn't literally greppable). Here "Compute next version" succeeds fine —cargo metadataresolvestinycortex's version correctly. The failure is entirely aboutcargo package/cargo publishbeing run against a crate graph that isn't publishable yet.Fix
.github/workflows/release.yml: add a Check crates.io publishability step that reads the resolvedpublishfield for$CRATE_NAMEviacargo metadata --no-deps --format-version 1 | jq, and gate the Package crate / Publish to crates.io steps on it being publishable (publishisnull, not[]). While it'spublish = false, those two steps are skipped (with a::notice::) instead of hard-failing the whole release — which also means the version-bump commit and git tag still get pushed, since "Push release commit and tag" runs unconditionally. Also scoped bothcargo package/cargo publishinvocations to-p "$CRATE_NAME"soapi/(never meant to be published by this workflow) isn't swept in once packaging does become possible.Verification
Ran locally in the checkout:
cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="tinycortex") | .publish'→[], matching the new skip condition.cargo package -p tinycortex-api --lockedandcargo package -p tinycortex --lockedboth reproduce the exact CI failure locally (manifest verification error / unresolvabletinycortex-apion crates.io respectively), confirming root cause.cargo package --list -p tinycortex --lockedsucceeds and lists only the root crate's files.main; this is a workflow-only fix).Test plan
gh workflow run release.yml --ref main -f bump=patchafter merge and confirm the release job completes: version bump, tag, and push succeed, and "Package crate"/"Publish to crates.io" are skipped with the new notice (untiltinymemory#18 §A1makes the crate genuinely publishable).