Skip to content

Commit 6372dae

Browse files
authored
fix(ci): only sleep after real publishes, not skips (crates.io rate limit) (#61)
1 parent ea818b9 commit 6372dae

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
# --no-verify skips rebuild (CI already validated).
9393
# Retry up to 3 times with 30s delay for index propagation.
9494
PUBLISHED=false
95+
SKIPPED=false
9596
for attempt in 1 2 3; do
9697
OUTPUT=$(cargo publish -p "$crate" --no-verify $EXTRA_ARGS 2>&1) && {
9798
echo "Published $crate successfully"
@@ -100,7 +101,7 @@ jobs:
100101
}
101102
if echo "$OUTPUT" | grep -qE "already uploaded|already exists"; then
102103
echo "$crate already published, skipping"
103-
PUBLISHED=true
104+
SKIPPED=true
104105
break
105106
fi
106107
if [ "$attempt" -lt 3 ]; then
@@ -110,12 +111,15 @@ jobs:
110111
fi
111112
done
112113
echo "::endgroup::"
113-
if [ "$PUBLISHED" = "false" ]; then
114+
if [ "$PUBLISHED" = "false" ] && [ "$SKIPPED" = "false" ]; then
114115
echo "$OUTPUT"
115116
echo "::error::Failed to publish $crate after 3 attempts"
116117
exit 1
117118
fi
118-
sleep 65 # pause for rate limit: crates.io allows ~6 new crates per 5 min window
119+
# Only sleep after a real publish (not a skip) to stay under rate limit.
120+
if [ "$PUBLISHED" = "true" ]; then
121+
sleep 65 # pause for rate limit: crates.io allows ~6 new crates per 5 min window
122+
fi
119123
done
120124
echo "All crates published successfully"
121125
env:

0 commit comments

Comments
 (0)