From 8ce8fc780fd4f63e067a30d9131962923ad83f3b Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 26 Feb 2021 21:16:19 +0800 Subject: [PATCH] Improve the bump tool --- tools/bump.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/bump.sh b/tools/bump.sh index c3f8b89..5c67b52 100755 --- a/tools/bump.sh +++ b/tools/bump.sh @@ -44,7 +44,7 @@ check() { fi # ensure the current branch is 'master' - if [[ "$(git branch --show-current)" != "master" ]]; then + if [[ "$(git branch --show-current)" != "master" && manual_release == "false" ]]; then echo "Error: This operation must be performed on the 'master' branch!" exit -1 fi @@ -147,6 +147,17 @@ release() { } +help() { + echo "Bump new version to Chirpy project" + echo "Usage:" + echo + echo " bash /path/to/bump.sh [options]" + echo + echo "Options:" + echo " -m, --manual Manual relase, bump version only." + echo " -h, --help Print this help information." +} + main() { check @@ -179,6 +190,10 @@ while (($#)); do manual_release=true shift ;; + -h | --help) + help + exit 0 + ;; *) echo "unknown option '$opt'!" exit 1