mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Check that the crate has finished publishing
This commit is contained in:
parent
322fff7e3d
commit
94688d517b
32
.github/scripts/publish-crate.sh
vendored
32
.github/scripts/publish-crate.sh
vendored
|
@ -2,11 +2,43 @@
|
||||||
|
|
||||||
set -e # Fail if any command fails
|
set -e # Fail if any command fails
|
||||||
|
|
||||||
|
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.]+')
|
||||||
|
|
||||||
|
local attempts=0
|
||||||
|
|
||||||
|
while [ $attempts -le 15 ]; do
|
||||||
|
echo "Polling crates.io to see if the version has updated"
|
||||||
|
if curl "$url_to_poll" | grep "$expected_version"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 30s
|
||||||
|
attempts=$((attempts + 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
PROJECTS_TO_RELEASE_IN_ORDER="agb-macros agb-fixnum agb-image-converter agb-sound-converter agb"
|
PROJECTS_TO_RELEASE_IN_ORDER="agb-macros agb-fixnum agb-image-converter agb-sound-converter agb"
|
||||||
|
|
||||||
for PROJECT in $PROJECTS_TO_RELEASE_IN_ORDER; do
|
for PROJECT in $PROJECTS_TO_RELEASE_IN_ORDER; do
|
||||||
pushd "$PROJECT"
|
pushd "$PROJECT"
|
||||||
echo "Publishing $PROJECT"
|
echo "Publishing $PROJECT"
|
||||||
cargo publish
|
cargo publish
|
||||||
|
wait_for_release "$PROJECT"
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue