generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa82456
commit 7288b60
Showing
1 changed file
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |