From 567d623bed227883cbad66b22e49d3bf58fef488 Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sun, 17 Mar 2024 17:21:42 -0400 Subject: [PATCH] Allow deployment from master, main, or release/ branches --- maven-central-deploy.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/maven-central-deploy.sh b/maven-central-deploy.sh index 96f6987..0fc48ed 100755 --- a/maven-central-deploy.sh +++ b/maven-central-deploy.sh @@ -44,12 +44,13 @@ while getopts 'hnst' opt; do done # ensure the current branch is master or main -echo "Checking branch is 'master' or 'main'" +echo "Checking branch is 'master' or 'main' or starts with 'release/'" current_branch=$(git rev-parse --abbrev-ref HEAD) -if [ "$current_branch" != 'master' ] && [ "$current_branch" != 'main' ]; then - echo 'WARNING: Must be on the master or main branch to release' +if [ "$current_branch" != 'master' ] && [ "$current_branch" != 'main' ] && [[ ! "$current_branch" =~ ^release/ ]]; then + echo 'WARNING: Must be on master, main, or a branch starting with "release/" to release' exit 1 fi +echo "Branch is OK [${current_branch}]" # fetch latest information from remote repository and ensure there are no remote changes echo 'Checking repository is up to date'