From 5ffe236289d6cd0c3e11f749c4661e5cb5fff1d6 Mon Sep 17 00:00:00 2001 From: Simon Davies Date: Thu, 2 Jul 2026 22:20:06 +0100 Subject: [PATCH] Fix the crates.io check for crate version Signed-off-by: Simon Davies --- .github/workflows/cargo-publish.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cargo-publish.yml b/.github/workflows/cargo-publish.yml index d3da5620..6420087b 100644 --- a/.github/workflows/cargo-publish.yml +++ b/.github/workflows/cargo-publish.yml @@ -70,7 +70,11 @@ jobs: return fi - if cargo info --locked -q "$crate"@"$VERSION" > /dev/null; then + # Query crates.io from /tmp in a subshell so `cargo info` does not + # read the workspace manifest or lockfile. The subshell exits + # back to the original PWD automatically. `--locked` is omitted + # because there is no Cargo.lock in /tmp. + if (cd /tmp && cargo info -q "$crate"@"$VERSION") > /dev/null; then echo "PUBLISH_${crate_env_var}=false" >> "$GITHUB_ENV" echo "✅ $crate@$VERSION already exists." else