Use the new publish crate tool

This commit is contained in:
Gwilym Kuiper 2022-08-04 21:30:52 +01:00
parent 0fea113fa2
commit 375c878849
3 changed files with 8 additions and 46 deletions

View file

@ -1,44 +0,0 @@
#!/usr/bin/env bash
set -e # Fail if any command fails
function wait_for_release() {
local package="$1"
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=1
while [ $attempts -le 15 ]; do
echo "Polling crates.io with URL $url_to_poll to see if the version has updated (attempt $attempts)"
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"
for PROJECT in $PROJECTS_TO_RELEASE_IN_ORDER; do
pushd "$PROJECT"
echo "Publishing $PROJECT"
cargo publish
wait_for_release "$PROJECT"
popd
done

View file

@ -19,8 +19,10 @@ jobs:
- name: Login to crates.io
run: cargo login ${{ secrets.CRATE_API }}
- uses: extractions/setup-just@v1
- name: Publish crates
run: bash .github/scripts/publish-crate.sh
run: just publish
- name: Update template repo
env:
@ -30,7 +32,6 @@ jobs:
- name: Install gbafix
run: cargo install gbafix
- uses: extractions/setup-just@v1
- name: Build the examples
run: just build-roms
- name: Upload examples to the release

View file

@ -64,6 +64,11 @@ update-linker-scripts:
find -type f -name gba.ld | grep -v ./agb/gba.ld | xargs -n1 cp -v -- agb/gba.ld
find -type f -name gba_mb.ld | grep -v ./agb/gba_mb.ld | xargs -n1 cp -v -- agb/gba_mb.ld
publish: (_run-tool "publish")
_run-tool +tool:
cargo run --manifest-path "{{justfile_directory() + "/tools/Cargo.toml"}}" -- {{tool}}
_build-rom folder name:
#!/usr/bin/env bash
set -euxo pipefail