2022-01-13 09:46:48 +11:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e # Fail if any command fails
|
|
|
|
|
2022-07-15 07:32:58 +10:00
|
|
|
function wait_for_release() {
|
|
|
|
local package="$0"
|
|
|
|
local package_with_underscores="${package/-/_}"
|
|
|
|
|
|
|
|
local first_two_characters="${package_with_underscores:0:2}"
|
|
|
|
local second_two_characters="${package_with_underscores:2:2}"
|
|
|
|
|
|
|
|
local path="$first_two_characters/$second_two_characters"
|
|
|
|
|
|
|
|
if [ "$package" == "agb" ]; then
|
|
|
|
path="3/a"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local url_to_poll="https://raw.githubusercontent.com/rust-lang/crates.io-index/master/$path/$package_with_underscores"
|
|
|
|
|
|
|
|
local expected_version
|
|
|
|
expected_version=$(grep -E '^version' Cargo.toml | grep -oE '[0-9.]+')
|
|
|
|
|
2022-07-15 07:33:39 +10:00
|
|
|
local attempts=1
|
2022-07-15 07:32:58 +10:00
|
|
|
|
|
|
|
while [ $attempts -le 15 ]; do
|
2022-07-15 07:33:39 +10:00
|
|
|
echo "Polling crates.io to see if the version has updated (attempt $attempts)"
|
2022-07-15 07:32:58 +10:00
|
|
|
if curl "$url_to_poll" | grep "$expected_version"; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 30s
|
|
|
|
attempts=$((attempts + 1))
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-07-15 07:16:02 +10:00
|
|
|
PROJECTS_TO_RELEASE_IN_ORDER="agb-macros agb-fixnum agb-image-converter agb-sound-converter agb"
|
2022-01-13 09:46:48 +11:00
|
|
|
|
2022-07-04 03:10:16 +10:00
|
|
|
for PROJECT in $PROJECTS_TO_RELEASE_IN_ORDER; do
|
|
|
|
pushd "$PROJECT"
|
|
|
|
echo "Publishing $PROJECT"
|
|
|
|
cargo publish
|
2022-07-15 07:32:58 +10:00
|
|
|
wait_for_release "$PROJECT"
|
2022-07-04 03:10:16 +10:00
|
|
|
popd
|
|
|
|
done
|