Skip to content

Commit

Permalink
Allow deployment from master, main, or release/ branches
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight committed Mar 17, 2024
1 parent c51fcc6 commit 567d623
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions maven-central-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 567d623

Please sign in to comment.