From 31f52d4febec84a16927cba7c0bddd83c3a2aaef Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Sun, 30 Aug 2026 21:30:29 +0300 Subject: [PATCH] fix(ci): skip crates.io package/publish while the crate is unpublishable 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 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 237eeb9..00cc801 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,8 +118,31 @@ jobs: git commit -m "Release ${RELEASE_TAG}" git tag -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG}" + # `$CRATE_NAME` (and its path dependency `tinycortex-api`) both carry + # `publish = false` right now: `tinycortex-api` depends on `tinymemory-api` + # by git rev, and cargo refuses to package/publish a crate whose + # dependency graph contains an unpublished git/path dependency (see the + # `publish = false` comments in Cargo.toml and api/Cargo.toml, tracked as + # tinymemory#18 §A1). Packaging or publishing while that holds always + # fails, so skip both steps until the crate is actually publishable + # instead of hard-failing the whole release (which also blocks the + # version-bump tag from ever being pushed). + - name: Check crates.io publishability + id: publishable + run: | + set -euo pipefail + + publish="$(cargo metadata --no-deps --format-version 1 | jq -r --arg crate "$CRATE_NAME" '.packages[] | select(.name == $crate) | .publish')" + if [[ "$publish" == "[]" ]]; then + echo "publishable=false" >> "$GITHUB_OUTPUT" + echo "::notice::${CRATE_NAME} has publish = false; skipping crates.io package/publish steps." + else + echo "publishable=true" >> "$GITHUB_OUTPUT" + fi + - name: Package crate - run: cargo package --locked + if: steps.publishable.outputs.publishable == 'true' + run: cargo package --locked -p "$CRATE_NAME" - name: Push release commit and tag env: @@ -129,6 +152,7 @@ jobs: git push origin "${RELEASE_TAG}" - name: Publish to crates.io - run: cargo publish --locked + if: steps.publishable.outputs.publishable == 'true' + run: cargo publish --locked -p "$CRATE_NAME" env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}