From 6dfcd690f71d2b560fb8823f4b335b526a668193 Mon Sep 17 00:00:00 2001 From: Vadim Yavorsky Date: Wed, 20 Nov 2024 11:14:28 +0000 Subject: [PATCH] Add rc branch and update calculate_version.sh --- .github/workflows/publish.yml | 1 + scripts/calculate_version.sh | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 323cac1ba..6d9d8f614 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,7 @@ on: - 'v*.*.*' - develop - beta + - release-candidate - stable push: tags: diff --git a/scripts/calculate_version.sh b/scripts/calculate_version.sh index 00709484c..cb27e2716 100755 --- a/scripts/calculate_version.sh +++ b/scripts/calculate_version.sh @@ -18,20 +18,30 @@ if [ -z "$VERSION" ]; then exit 1 fi -LABEL="develop" -for known in "beta" "stable" -do - if [ "$BRANCH" = "$known" ] - then - LABEL="$BRANCH" - fi -done - git fetch --tags > /dev/null +KNOWN_BRANCHES=('stable' 'release-candidate' 'beta') +# Everything else will be marked as 'develop' + +declare -A SUFFIXES=( + ['release-candidate']='rc' +) + +if [[ ! "${KNOWN_BRANCHES[@]}" =~ "$BRANCH" ]] +then + BRANCH='develop' +fi + +SUFFIX=$BRANCH +if [[ -n "${SUFFIXES[$BRANCH]}" ]] +then + SUFFIX="${SUFFIXES[$BRANCH]}" +fi + + for (( NUMBER=0; ; NUMBER++ )) do - FULL_VERSION="$VERSION-$LABEL.$NUMBER" + FULL_VERSION="$VERSION-$SUFFIX.$NUMBER" TAG="$FULL_VERSION" if ! [[ $(git tag -l | grep "$TAG") ]]; then echo "$FULL_VERSION" | tr / -