Skip to content

Commit 66e293e

Browse files
fix(ci): improve crates.io publication check robustness (#279)
* feat(ci): optimize CI/CD pipeline for better performance - Split CI into parallel jobs for faster execution - Add path filters to skip CI for documentation-only changes - Create separate docs workflow for markdown and mdBook checks - Improve caching with more granular cache keys - Add fail-fast strategy to stop early on failures - Parallelize unit tests by package - Make platform builds optional (only Linux required) - Add environment optimizations (CARGO_INCREMENTAL, reduced debuginfo) - Only run coverage on main branch - Add comprehensive documentation checks (lint, links, build) These optimizations should reduce CI time by 40-50% for most PRs * fix(ci): improve crates.io publication check robustness - Redirect stderr to avoid 'note:' messages interfering with grep - Capture search output for debugging when check fails - Add debug output to see what cargo search returns - This should fix the false positives where already-published crates are detected as needing publishing * fix(ci): remove npm cache configuration from docs workflow The npm cache was looking for package-lock.json files that don't exist. Since we only install markdownlint-cli globally, we don't need npm caching.
1 parent 8cb8e5d commit 66e293e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/publish-crates.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99
inputs:
1010
dry-run:
11-
description: 'Dry run (do not actually publish)'
11+
description: "Dry run (do not actually publish)"
1212
required: false
1313
default: false
1414
type: boolean
@@ -59,10 +59,15 @@ jobs:
5959
echo "Checking $crate v$CRATE_VERSION..."
6060
6161
# Check if this version is already on crates.io
62-
if cargo search $crate --limit 1 | grep -q "^$crate = \"$CRATE_VERSION\""; then
62+
# Capture both stdout and stderr, ignore stderr output (the "note:" lines)
63+
SEARCH_OUTPUT=$(cargo search "$crate" --limit 1 2>/dev/null || true)
64+
65+
# Check if the exact version is found
66+
if echo "$SEARCH_OUTPUT" | grep -q "^${crate} = \"${CRATE_VERSION}\""; then
6367
echo " ✓ $crate v$CRATE_VERSION is already published"
6468
else
6569
echo " → $crate v$CRATE_VERSION needs publishing"
70+
echo " Search output was: $SEARCH_OUTPUT"
6671
NEEDS_PUBLISH="$NEEDS_PUBLISH $crate"
6772
fi
6873
done
@@ -141,10 +146,12 @@ jobs:
141146
CRATE_VERSION=$(grep "^version" crates/$crate/Cargo.toml | sed 's/.*= *"\(.*\)"/\1/')
142147
echo -n "Checking $crate v$CRATE_VERSION... "
143148
144-
if cargo search $crate --limit 1 | grep -q "^$crate = \"$CRATE_VERSION\""; then
149+
SEARCH_OUTPUT=$(cargo search "$crate" --limit 1 2>/dev/null || true)
150+
if echo "$SEARCH_OUTPUT" | grep -q "^${crate} = \"${CRATE_VERSION}\""; then
145151
echo "✓ Published!"
146152
else
147153
echo "✗ Not found!"
154+
echo "Search output: $SEARCH_OUTPUT"
148155
exit 1
149156
fi
150157
done

0 commit comments

Comments
 (0)