From 1bc23201f0285e2224bca19f42461c9c1005d7a7 Mon Sep 17 00:00:00 2001
From: Daniel Haag <daniel.haag@uibk.ac.at>
Date: Tue, 3 Dec 2019 18:28:49 +0100
Subject: [PATCH] openolat#140: create new tags also when no previous can be
 found for this major.minor release

---
 scripts/uibk-release.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/uibk-release.sh b/scripts/uibk-release.sh
index 7b09d1ef068..a85df7f6c50 100755
--- a/scripts/uibk-release.sh
+++ b/scripts/uibk-release.sh
@@ -15,7 +15,10 @@ echo "The last 5 (un)merged uibk tags:"
 echo "The last 5 merged uibk tags:"
 /usr/bin/git tag -l --merged HEAD --sort creatordate|grep '\.uibk-'|tail -n 5
 
-LASTTAG=$(/usr/bin/git tag -l --merged HEAD --sort creatordate|grep '\.uibk-'|tail -n 1)
+echo "The last 5 merged uibk tags for this major, minor and patch version:"
+/usr/bin/git tag -l --merged HEAD --sort creatordate|grep -F "${CODE_VERSION_MMP}.uibk-"|tail -n 5
+
+LASTTAG=$(/usr/bin/git tag -l --merged HEAD --sort creatordate|grep -F "${CODE_VERSION_MMP}.uibk-"|tail -n 1)
 LASTTAG_VERSION_MMPU=${LASTTAG#*OpenOLAT_}
 LASTTAG_VERSION_MMP=${LASTTAG_VERSION_MMPU%.uibk*}
 LASTTAG_VERSION_MM=${LASTTAG_VERSION_MMP%.*}
@@ -25,11 +28,8 @@ set -e
 echo "Checking out the current head as the branch name we are building in:"
 git checkout -B "$CI_BUILD_REF_NAME" "$CI_BUILD_REF"
 
-echo "Testing that the major and minor version of the last tag are equal to the one in olat.properties"
-test "${LASTTAG_VERSION_MM}" = "${CODE_VERSION_MM}"
-
-echo "Testing that the major and minor version of the last tag are equal to the one in the branch name"
-test "${LASTTAG_VERSION_MM}" = "${GIT_REF_VERSION_MM}"
+echo "Testing that the major and minor version from olat.properties and the branch name match"
+test "${CODE_VERSION_MM}" = "${GIT_REF_VERSION_MM}"
 
 echo "Check if the olat.properties patch release is the same as in our last tag"
 if [[ "$LASTTAG_VERSION_MMP" = "$CODE_VERSION_MMP" ]]
@@ -49,7 +49,7 @@ then
 	exit 1
 fi
 
-echo "Test if the detached head commit ($CI_COMMIT_SHA) is equal to the release branch ($CI_COMMIT_REF_NAME)" 
+echo "Test if the detached head commit ($CI_COMMIT_SHA) is equal to the release branch ($CI_COMMIT_REF_NAME)"
 if git diff --exit-code $CI_COMMIT_SHA origin/$CI_COMMIT_REF_NAME
 then
 	echo "SHA and REF are equal so we can checkout the branch"
-- 
GitLab