Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a custom release bash script, because the previous GH action failed at different stages, so a part of it needed to be published manually. we'll see if this works this time. Co-authored-by: Tomas Tauber <me@tomtau.be>
- Loading branch information
Showing
8 changed files
with
69 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
CRATES="pest pest_meta pest_vm pest_generator pest_derive pest_grammars" | ||
|
||
get_local_version() { | ||
cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "'"${1}"'" and ((.manifest_path|contains("registry"))|not))|.version' | ||
} | ||
|
||
check_version_online() { | ||
curl -s "https://crates.io/api/v1/crates/${1}" | jq -r '.versions[]|select(.num == "'"${2}"'").updated_at' | ||
} | ||
|
||
get_manifest_path() { | ||
cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "'"${1}"'" and ((.manifest_path|contains("registry"))|not))|.manifest_path' | ||
} | ||
|
||
publish() { | ||
echo "Publishing crate $1..." | ||
cargo publish --manifest-path "$(get_manifest_path "${1}")" --allow-dirty --all-features | ||
echo "" | ||
} | ||
|
||
wait_until_available() { | ||
echo "Waiting for crate ${1} to become available via crates.io..." | ||
for retry in {1..5}; do | ||
sleep 5 | ||
ONLINE_DATE="$(check_version_online "${1}" "${2}")" | ||
if [ -n "${ONLINE_DATE}" ]; then | ||
echo "Crate ${crate} is now available online" | ||
break | ||
else | ||
if [ "${retry}" == 5 ]; then | ||
echo "ERROR: Crate should have become available by now" | ||
exit 1 | ||
else | ||
echo "Not available just yet. Waiting a few seconds..." | ||
fi | ||
fi | ||
done | ||
echo "Waiting an additional 10 seconds for crate to propagate through CDN..." | ||
sleep 10 | ||
} | ||
|
||
for crate in ${CRATES}; do | ||
VERSION="$(get_local_version "${crate}")" | ||
publish "${crate}" | ||
wait_until_available "${crate}" "${VERSION}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters