Skip to content

Commit cca37cc

Browse files
committed
ci(release): add a dry-run phase
1 parent e5ead10 commit cca37cc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

release.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ publish() {
6262
echo ""
6363
}
6464

65+
dry_publish() {
66+
echo "Publishing crate $1..."
67+
cargo publish --dry-run --manifest-path "$(get_manifest_path "${1}")" ${CARGO_PUBLISH_FLAGS}
68+
echo ""
69+
}
70+
6571
wait_until_available() {
6672
echo "Waiting for crate ${1} to become available via crates.io..."
6773
for retry in {1..5}; do
@@ -83,6 +89,38 @@ wait_until_available() {
8389
sleep 10
8490
}
8591

92+
echo "Doing a dry-run"
93+
for crate in ${CRATES}; do
94+
dry_publish "${crate}"
95+
done
96+
97+
echo "Attempting to publish crate(s): ${CRATES}"
98+
99+
# Since crates.io has rate-limit and we always want to publish
100+
# every crate in lockstep, we need to wait 5min every 5 pubs
101+
COUNTER=1
102+
103+
for crate in ${CRATES}; do
104+
VERSION="$(get_local_version "${crate}")"
105+
ONLINE_DATE="$(check_version_online "${crate}" "${VERSION}")"
106+
echo "${crate} version number: ${VERSION}"
107+
if [ -n "${ONLINE_DATE}" ]; then
108+
echo "${crate} ${VERSION} has already been published at ${ONLINE_DATE}, skipping"
109+
continue
110+
fi
111+
112+
if [ $COUNTER -eq 5 ]; then
113+
echo "Reached 5 crates, waiting for 5 minutes..."
114+
sleep 300 # Wait for 5 minutes
115+
COUNTER=1 # Reset the counter
116+
fi
117+
118+
publish "${crate}"
119+
wait_until_available "${crate}" "${VERSION}"
120+
((COUNTER++))
121+
done
122+
123+
86124
echo "Attempting to publish crate(s): ${CRATES}"
87125

88126
# Since crates.io has rate-limit and we always want to publish

0 commit comments

Comments
 (0)