From 7288b609fd29b1758f6c7830f639de968d89c365 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Fri, 22 Dec 2023 12:00:10 +0100 Subject: [PATCH] improve release branch --- .github/scripts/verify_is_on_release_branch.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/scripts/verify_is_on_release_branch.sh b/.github/scripts/verify_is_on_release_branch.sh index 7730282fa..9f052c274 100755 --- a/.github/scripts/verify_is_on_release_branch.sh +++ b/.github/scripts/verify_is_on_release_branch.sh @@ -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