Merge pull request #249 from gwilymk/release-all-subcrates-at-the-same-time

Release all subcrates at the same time
This commit is contained in:
Gwilym Kuiper 2022-07-14 22:15:18 +01:00 committed by GitHub
commit 6a8aeeb3e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 95 additions and 133 deletions

View file

@ -2,7 +2,11 @@
set -e # Fail if any command fails set -e # Fail if any command fails
RELEASE_TAG=$(git tag --points-at HEAD) PROJECTS_TO_RELEASE_IN_ORDER="agb-fixnum agb-macros agb-image-converter agb-sound-converter agb"
PROJECT=${RELEASE_TAG/\/*/} for PROJECT in $PROJECTS_TO_RELEASE_IN_ORDER; do
(cd "$PROJECT" && cargo publish) pushd "$PROJECT"
echo "Publishing $PROJECT"
cargo publish
popd
done

View file

@ -18,9 +18,9 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Login to crates.io - name: Login to crates.io
run: cargo login ${{ secrets.CRATE_API }} run: cargo login ${{ secrets.CRATE_API }}
- name: Publish agb
run: cargo publish - name: Publish crates
working-directory: ./agb run: bash .github/scripts/publish-crate.sh
- name: Update template repo - name: Update template repo
env: env:

View file

@ -1,19 +0,0 @@
name: Publish sub crate
on:
push:
tags:
- "*/v*"
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Install build tools
run: sudo apt-get update && sudo apt-get install build-essential binutils-arm-none-eabi -y
- name: Check out repository
uses: actions/checkout@v3
- name: Login to crates.io
run: cargo login ${{ secrets.CRATE_API }}
- name: Publish crate
run: bash .github/scripts/publish-crate.sh

View file

@ -122,9 +122,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.9.1" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -171,14 +171,12 @@ dependencies = [
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.23" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [ dependencies = [
"cfg-if 1.0.0",
"crc32fast", "crc32fast",
"libc", "miniz_oxide 0.5.3",
"miniz_oxide 0.5.1",
] ]
[[package]] [[package]]
@ -202,9 +200,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -243,9 +241,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.124" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]] [[package]]
name = "libflate" name = "libflate"
@ -261,9 +259,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.16" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
@ -279,9 +277,9 @@ dependencies = [
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.5.1" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
dependencies = [ dependencies = [
"adler", "adler",
] ]
@ -315,9 +313,9 @@ checksum = "a0f889fb66f7acdf83442c35775764b51fed3c606ab9cee51500dbde2cf528ca"
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.44" version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-traits", "num-traits",
@ -325,9 +323,9 @@ dependencies = [
[[package]] [[package]]
name = "num-iter" name = "num-iter"
version = "0.1.42" version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
@ -347,18 +345,18 @@ dependencies = [
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.14" version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.10.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
[[package]] [[package]]
name = "png" name = "png"
@ -374,18 +372,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.37" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.18" version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -404,18 +402,18 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.136" version = "1.0.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.136" version = "1.0.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -430,13 +428,13 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.91" version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -457,9 +455,9 @@ dependencies = [
[[package]] [[package]]
name = "tiled" name = "tiled"
version = "0.9.5" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9b76189425fed476c9cb0e2a97adb0c6c9d370bf69a57cb951814e77a5fe63" checksum = "8d2c30aeea9d8159cb461a17dba23ad28980a2a9c217a6784a14e931e4979d6f"
dependencies = [ dependencies = [
"base64", "base64",
"libflate", "libflate",
@ -477,15 +475,15 @@ dependencies = [
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
version = "0.15.0" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c74c96594835e10fa545e2a51e8709f30b173a092bfd6036ef2cec53376244f3" checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-ident"
version = "0.2.2" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
[[package]] [[package]]
name = "version_check" name = "version_check"
@ -495,9 +493,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.10.2+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "xml-rs" name = "xml-rs"

View file

@ -12,7 +12,7 @@ generational-arena = { version = "0.2", default-features = false }
[build-dependencies] [build-dependencies]
quote = "1.0.10" quote = "1.0.10"
tiled = { version = "0.9.5", default-features = false } tiled = { version = "0.9.4", default-features = false }
[profile.dev] [profile.dev]
opt-level = 2 opt-level = 2

View file

@ -3,13 +3,12 @@
# Fail if any command fails # Fail if any command fails
set -e set -e
PROJECT=$1 VERSION=$1
VERSION=$2 NO_COMMIT=$2
NO_COMMIT=$3
# Sanity check that we actually have a version # Sanity check that we actually have a version
if [ "$VERSION" = "" ]; then if [ "$VERSION" = "" ]; then
echo "Usage $0 <project> <version> [--no-commit]" echo "Usage $0 <version> [--no-commit]"
exit 1 exit 1
fi fi
@ -25,33 +24,16 @@ if [ ! "$NO_COMMIT" = "" ] && [ ! "$NO_COMMIT" = "--no-commit" ]; then
exit 1 exit 1
fi fi
# Set up $DIRECTORY and $TAGNAME function maybe_git() {
case "$PROJECT" in if [ "$NO_COMMIT" = "--no-commit" ]; then
agb) echo "Would run: git $*"
DIRECTORY="agb" else
TAGNAME="v$VERSION" git "$@"
;; fi
agb-*) }
if [ -f "$PROJECT/Cargo.toml" ]; then
DIRECTORY=$PROJECT
TAGNAME="$PROJECT/v$VERSION"
else
echo "Unknown project name $PROJECT"
exit 1
fi
;;
mgba-test-runner)
DIRECTORY="mgba-test-runner"
TAGNAME="mgba-test-runner/v$VERSION"
;;
*)
echo "Unknown project name $PROJECT"
exit 1
;;
esac
# Check that no out-standing changes in git # Check that no out-standing changes in git
if [ -n "$(git status --porcelain)" ]; then if [ "$NO_COMMIT" = "" ] && [ -n "$(git status --porcelain)" ]; then
echo "Uncommitted changes, please commit first" echo "Uncommitted changes, please commit first"
exit 1 exit 1
fi fi
@ -62,52 +44,49 @@ if [ ! "$NO_COMMIT" = "--no-commit" ] && [ "$(git symbolic-ref --short HEAD)" !=
exit 1 exit 1
fi fi
# Update the version in Cargo.toml TAGNAME="v$VERSION"
sed -i -e "s/^version = \".*\"/version = \"$VERSION\"/" "$DIRECTORY/Cargo.toml"
# Also update the lock file for PROJECT_TOML_FILE in agb/Cargo.toml agb-*/Cargo.toml; do
(cd "$DIRECTORY" && cargo update) DIRECTORY=$(dirname "$PROJECT_TOML_FILE")
git add "$DIRECTORY/Cargo.toml" "$DIRECTORY/Cargo.lock" || echo "Failed to git add a file, continuing anyway"
if [ "$PROJECT" = "agb" ]; then # Update the version in Cargo.toml
# also update the agb version in the template and the examples sed -i -e "s/^version = \".*\"/version = \"$VERSION\"/" "$DIRECTORY/Cargo.toml"
sed -i -e "s/^agb = \".*\"/agb = \"$VERSION\"/" template/Cargo.toml
git add template/Cargo.toml
for EXAMPLE_TOML_FILE in examples/*/Cargo.toml book/games/*/Cargo.toml; do # Also update the lock file
EXAMPLE_DIR=$(dirname "$EXAMPLE_TOML_FILE") (cd "$DIRECTORY" && cargo update)
sed -E -i -e "/agb =/ s/version = \"[^\"]+\"/version = \"$VERSION\"/" "$EXAMPLE_DIR/Cargo.toml"
(cd "$EXAMPLE_DIR" && cargo update)
git add "$EXAMPLE_DIR"/{Cargo.toml,Cargo.lock} || echo "Failed to git add a file, continuing anyway"
done
else
PROJECT_NAME_WITH_UNDERSCORES=$(echo -n "$PROJECT" | tr - _)
for CARGO_TOML_FILE in agb-*/Cargo.toml agb/Cargo.toml examples/*/Cargo.toml book/games/*/Cargo.toml; do if [ "$DIRECTORY" = "agb" ]; then
sed -i -E -e "s/($PROJECT_NAME_WITH_UNDERSCORES = .*version = \")[^\"]+(\".*)/\1$VERSION\2/" "$CARGO_TOML_FILE" # also update the agb version in the template and the examples
(cd "$(dirname "$CARGO_TOML_FILE")" && cargo generate-lockfile) sed -i -e "s/^agb = \".*\"/agb = \"$VERSION\"/" template/Cargo.toml
git add "$CARGO_TOML_FILE" "${CARGO_TOML_FILE/.toml/.lock}" || echo "Failed to git add a file, continuing anyway" for EXAMPLE_TOML_FILE in examples/*/Cargo.toml book/games/*/Cargo.toml; do
done EXAMPLE_DIR=$(dirname "$EXAMPLE_TOML_FILE")
fi sed -E -i -e "/agb =/ s/version = \"[^\"]+\"/version = \"$VERSION\"/" "$EXAMPLE_DIR/Cargo.toml"
(cd "$EXAMPLE_DIR" && cargo update)
done
else
PROJECT_NAME_WITH_UNDERSCORES=$(echo -n "$DIRECTORY" | tr - _)
for CARGO_TOML_FILE in agb-*/Cargo.toml agb/Cargo.toml examples/*/Cargo.toml book/games/*/Cargo.toml; do
sed -i -E -e "s/($PROJECT_NAME_WITH_UNDERSCORES = .*version = \")[^\"]+(\".*)/\1$VERSION\2/" "$CARGO_TOML_FILE"
(cd "$(dirname "$CARGO_TOML_FILE")" && cargo generate-lockfile)
done
fi
done
# Sanity check to make sure the build works # Sanity check to make sure the build works
for CARGO_TOML_FILE in agb-*/Cargo.toml agb/Cargo.toml; do just ci
(cd "$(dirname "$CARGO_TOML_FILE")" && cargo test)
done
for EXAMPLE_TOML_FILE in examples/*/Cargo.toml book/games/*/Cargo.toml; do for EXAMPLE_TOML_FILE in examples/*/Cargo.toml book/games/*/Cargo.toml; do
EXAMPLE_DIR=$(dirname "$EXAMPLE_TOML_FILE") EXAMPLE_DIR=$(dirname "$EXAMPLE_TOML_FILE")
(cd "$EXAMPLE_DIR" && cargo check --release) (cd "$EXAMPLE_DIR" && cargo check --release)
done done
if [ ! "$NO_COMMIT" = "--no-commit" ]; then # Commit the Cargo.toml changes
# Commit the Cargo.toml changes maybe_git commit -am "Release v$VERSION"
git commit -m "Release $PROJECT v$VERSION"
# Tag the version # Tag the version
git tag -a "$TAGNAME" -m "$PROJECT - v$VERSION" maybe_git tag -a "$TAGNAME" -m "v$VERSION"
echo "Done! Push with" echo "Done! Push with"
echo "git push --atomic origin master $TAGNAME" echo "git push --atomic origin master $TAGNAME"
fi