From 2f12748004cc807c7e75f771627baded98b0fa5c Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sun, 15 Aug 2021 23:15:25 +0100 Subject: [PATCH] Allow for easier testing --- release.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/release.sh b/release.sh index 991ca66c..c1e75dcc 100755 --- a/release.sh +++ b/release.sh @@ -5,10 +5,11 @@ set -e PROJECT=$1 VERSION=$2 +NO_COMMIT=$3 # Sanity check that we actually have a version if [ "$VERSION" = "" ]; then - echo "Usage $0 " + echo "Usage $0 [--no-commit]" exit 1 fi @@ -18,6 +19,12 @@ if [ ! "$(echo "$VERSION" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$")" ]; then exit 1 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 case "$PROJECT" in agb) @@ -49,8 +56,8 @@ if [ ! -z "$(git status --porcelain)" ]; then exit 1 fi -# Check that we are in the master branch -if [ "$(git symbolic-ref --short HEAD)" != "master" ]; then +# Check that we are in the master branch, but only if actually committing +if [ ! "$NO_COMMIT" = "--no-commit" ] && [ "$(git symbolic-ref --short HEAD)" != "master" ]; then echo "You must be in the master branch before releasing" exit 1 fi @@ -78,11 +85,13 @@ else git add agb/Cargo.toml agb/Cargo.lock fi -# Commit the Cargo.toml changes -git commit -m "Release $PROJECT v$VERSION" +if [ ! "$NO_COMMIT" = "--no-commit" ]; then + # Commit the Cargo.toml changes + git commit -m "Release $PROJECT v$VERSION" -# Tag the version -git tag -a $TAGNAME -m "$PROJECT - v$VERSION" + # Tag the version + git tag -a $TAGNAME -m "$PROJECT - v$VERSION" -echo "Done! Push with" -echo "git push --atomic origin master $TAGNAME" \ No newline at end of file + echo "Done! Push with" + echo "git push --atomic origin master $TAGNAME" +fi \ No newline at end of file