mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Attempt to rewrite the release script to release all subcrates at the same time
This commit is contained in:
parent
4a21cb0768
commit
7429219a4b
10
.github/scripts/publish-crate.sh
vendored
10
.github/scripts/publish-crate.sh
vendored
|
@ -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
|
||||||
|
|
60
release.sh
60
release.sh
|
@ -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,31 +24,6 @@ if [ ! "$NO_COMMIT" = "" ] && [ ! "$NO_COMMIT" = "--no-commit" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set up $DIRECTORY and $TAGNAME
|
|
||||||
case "$PROJECT" in
|
|
||||||
agb)
|
|
||||||
DIRECTORY="agb"
|
|
||||||
TAGNAME="v$VERSION"
|
|
||||||
;;
|
|
||||||
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 [ -n "$(git status --porcelain)" ]; then
|
||||||
echo "Uncommitted changes, please commit first"
|
echo "Uncommitted changes, please commit first"
|
||||||
|
@ -62,14 +36,19 @@ 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
|
||||||
|
sed -i -e "s/^version = \".*\"/version = \"$VERSION\"/" "$DIRECTORY/Cargo.toml"
|
||||||
|
|
||||||
|
# Also update the lock file
|
||||||
|
(cd "$DIRECTORY" && cargo update)
|
||||||
|
git add "$DIRECTORY/Cargo.toml" "$DIRECTORY/Cargo.lock" || echo "Failed to git add a file, continuing anyway"
|
||||||
|
|
||||||
|
if [ "$DIRECTORY" = "agb" ]; then
|
||||||
# also update the agb version in the template and the examples
|
# also update the agb version in the template and the examples
|
||||||
sed -i -e "s/^agb = \".*\"/agb = \"$VERSION\"/" template/Cargo.toml
|
sed -i -e "s/^agb = \".*\"/agb = \"$VERSION\"/" template/Cargo.toml
|
||||||
git add template/Cargo.toml
|
git add template/Cargo.toml
|
||||||
|
@ -80,8 +59,8 @@ if [ "$PROJECT" = "agb" ]; then
|
||||||
(cd "$EXAMPLE_DIR" && cargo update)
|
(cd "$EXAMPLE_DIR" && cargo update)
|
||||||
git add "$EXAMPLE_DIR"/{Cargo.toml,Cargo.lock} || echo "Failed to git add a file, continuing anyway"
|
git add "$EXAMPLE_DIR"/{Cargo.toml,Cargo.lock} || echo "Failed to git add a file, continuing anyway"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
PROJECT_NAME_WITH_UNDERSCORES=$(echo -n "$PROJECT" | tr - _)
|
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
|
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"
|
sed -i -E -e "s/($PROJECT_NAME_WITH_UNDERSCORES = .*version = \")[^\"]+(\".*)/\1$VERSION\2/" "$CARGO_TOML_FILE"
|
||||||
|
@ -89,7 +68,8 @@ else
|
||||||
|
|
||||||
git add "$CARGO_TOML_FILE" "${CARGO_TOML_FILE/.toml/.lock}" || echo "Failed to git add a file, continuing anyway"
|
git add "$CARGO_TOML_FILE" "${CARGO_TOML_FILE/.toml/.lock}" || echo "Failed to git add a file, continuing anyway"
|
||||||
done
|
done
|
||||||
fi
|
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
|
for CARGO_TOML_FILE in agb-*/Cargo.toml agb/Cargo.toml; do
|
||||||
|
@ -103,10 +83,10 @@ done
|
||||||
|
|
||||||
if [ ! "$NO_COMMIT" = "--no-commit" ]; then
|
if [ ! "$NO_COMMIT" = "--no-commit" ]; then
|
||||||
# Commit the Cargo.toml changes
|
# Commit the Cargo.toml changes
|
||||||
git commit -m "Release $PROJECT v$VERSION"
|
git commit -m "Release v$VERSION"
|
||||||
|
|
||||||
# Tag the version
|
# Tag the version
|
||||||
git tag -a "$TAGNAME" -m "$PROJECT - v$VERSION"
|
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"
|
||||||
|
|
Loading…
Reference in a new issue