Skip to content

Commit 5569c0e

Browse files
authored
Fix the crates.io check for crate version (#228)
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent 1fd9aaa commit 5569c0e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/cargo-publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ jobs:
7070
return
7171
fi
7272
73-
if cargo info --locked -q "$crate"@"$VERSION" > /dev/null; then
73+
# Query crates.io from /tmp in a subshell so `cargo info` does not
74+
# read the workspace manifest or lockfile. The subshell exits
75+
# back to the original PWD automatically. `--locked` is omitted
76+
# because there is no Cargo.lock in /tmp.
77+
if (cd /tmp && cargo info -q "$crate"@"$VERSION") > /dev/null; then
7478
echo "PUBLISH_${crate_env_var}=false" >> "$GITHUB_ENV"
7579
echo "✅ $crate@$VERSION already exists."
7680
else

0 commit comments

Comments
 (0)