mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Allow for easier testing
This commit is contained in:
parent
7e268ba8ce
commit
2f12748004
27
release.sh
27
release.sh
|
@ -5,10 +5,11 @@ set -e
|
||||||
|
|
||||||
PROJECT=$1
|
PROJECT=$1
|
||||||
VERSION=$2
|
VERSION=$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>"
|
echo "Usage $0 <project> <version> [--no-commit]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -18,6 +19,12 @@ if [ ! "$(echo "$VERSION" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$")" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if no commit option is valid
|
||||||
|
if [ ! "$NO_COMMIT" = "" ] || [ ! "$NO_COMMIT" = "--no-commit" ]; then
|
||||||
|
echo "Must pass either no last argument or --no-commit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set up $DIRECTORY and $TAGNAME
|
# Set up $DIRECTORY and $TAGNAME
|
||||||
case "$PROJECT" in
|
case "$PROJECT" in
|
||||||
agb)
|
agb)
|
||||||
|
@ -49,8 +56,8 @@ if [ ! -z "$(git status --porcelain)" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that we are in the master branch
|
# Check that we are in the master branch, but only if actually committing
|
||||||
if [ "$(git symbolic-ref --short HEAD)" != "master" ]; then
|
if [ ! "$NO_COMMIT" = "--no-commit" ] && [ "$(git symbolic-ref --short HEAD)" != "master" ]; then
|
||||||
echo "You must be in the master branch before releasing"
|
echo "You must be in the master branch before releasing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -78,11 +85,13 @@ else
|
||||||
git add agb/Cargo.toml agb/Cargo.lock
|
git add agb/Cargo.toml agb/Cargo.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Commit the Cargo.toml changes
|
if [ ! "$NO_COMMIT" = "--no-commit" ]; then
|
||||||
git commit -m "Release $PROJECT v$VERSION"
|
# Commit the Cargo.toml changes
|
||||||
|
git commit -m "Release $PROJECT v$VERSION"
|
||||||
|
|
||||||
# Tag the version
|
# Tag the version
|
||||||
git tag -a $TAGNAME -m "$PROJECT - v$VERSION"
|
git tag -a $TAGNAME -m "$PROJECT - 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
|
Loading…
Reference in a new issue