From 328bb41bda4e283fd5ea6f10d2064e4921533d8e Mon Sep 17 00:00:00 2001 From: NBTX Date: Tue, 9 Jun 2020 23:21:25 +0100 Subject: [PATCH] Add publish command to build script --- build.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ version.properties | 4 ++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 3cdc120..001cf07 100755 --- a/build.sh +++ b/build.sh @@ -59,6 +59,55 @@ if [ "$1" = "clean" ]; then exit 0 fi +# +# COMMAND: publish +# +if [ "$1" = "publish" ]; then + RELEASE_TAG_NAME="v$VERSION_NAME" + + CONFIRMED=0 + case "$@[@]" in *"-c"*) CONFIRMED=1 ;; esac + + echo "Validating..." + if GIT_DIR=./.git git rev-parse "$RELEASE_TAG_NAME" >/dev/null 2>&1; then + echo "Version $VERSION_NAME already exists! (perhaps you need to bump version name and code.)" + exit 1 + fi + + echo "Validation succeeded." + echo "" + + + if [ "$CONFIRMED" -ne 1 ]; then + echo "========================================" + echo "You are preparing the following release:" + echo "========================================" + echo "" + echo "Version Name: $VERSION_NAME" + echo "Version Code: $VERSION_CODE" + echo "" + echo "Before pushing, please ensure you have:" + echo "- tested your build thoroughly on" + echo " all supported systems." + echo "- sufficiently selected and/or bumped" + echo " the version number for your release." + echo "" + echo "" + echo "To confirm you have done this, please" + echo "run the same command again, specifying" + echo "-c." + exit 0 + fi + + echo "Preparing new release..." + git tag -a "$RELEASE_TAG_NAME" + + echo "Pushing release..." + git push origin "$RELEASE_TAG_NAME" + + exit 0 +fi + # # COMMAND: build # diff --git a/version.properties b/version.properties index 66353d2..6e12782 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ # Version Information -VERSION_NAME=0.0.3 -VERSION_CODE=3 +VERSION_NAME=0.0.1 +VERSION_CODE=1 \ No newline at end of file