Skip to content

Commit

Permalink
improve release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrichwilken committed Dec 22, 2023
1 parent fa82456 commit 7288b60
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/scripts/verify_is_on_release_branch.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env bash

# This script verifies, that the current branch name starts with 'release-'
# This script verifies, that the current branch name is 'release-x.y', where x and y are multi-digit integers.

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$CURRENT_BRANCH" == release-* ]]; then
echo "Branch name starts with 'release-'."
# Get the current Git branch name.
current_branch=$(git rev-parse --abbrev-ref HEAD)

# Define the pattern.
pattern="^release-[0-9]+[0-9]*\.[0-9]+[0-9]*$"

# Check if the branch name matches the pattern.
if [[ $current_branch =~ $pattern ]]; then
echo "the current branch ($current_branch) is a release branch"
exit 0
else
echo "Branch name does not start with 'release-'."
echo "error; the current branch ($current_branch) is not a release branch"
exit 1
fi

0 comments on commit 7288b60

Please sign in to comment.