From f7badd136d2012d58b079381312d481c75507096 Mon Sep 17 00:00:00 2001
From: Jan Wennrich <jan.wennrich@pcsg.de>
Date: Fri, 24 May 2024 13:53:17 +0000
Subject: [PATCH] feat!: next major release

---
 .gitlab-ci.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fa4c540..de04be5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,11 +15,13 @@ release:
       {"tagFormat":"${version}","branches":["+([0-9])?(.{+([0-9]),x}).x","master","main"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits"}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits"}],["@semantic-release/gitlab",{"gitlabUrl":"https://dev.quiqqer.com","assignee":"JanWennrich"}]]}
       ' > .releaserc.json); fi
     - semantic-release
-    - RELEASED_MAJOR_VERSION=$(git describe --abbrev=0 --tags | cut -c1)
+    - RELEASED_VERSION=$(git describe --abbrev=0 --tags)
+    - echo $RELEASED_VERSION
+    - RELEASED_MAJOR_VERSION=$(echo ${RELEASED_VERSION} | cut -c1)
     - echo $RELEASED_MAJOR_VERSION
     - NEXT_MAJOR_VERSION=$((${RELEASED_MAJOR_VERSION}+1))
     - echo $NEXT_MAJOR_VERSION
-    - if [ "$CURRENT_MAJOR_VERSION" -gt 0 ] && [ "$RELEASED_MAJOR_VERSION" -gt "$CURRENT_MAJOR_VERSION" ]; then (curl -v --request POST --header "PRIVATE-TOKEN:${GITLAB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/branches?branch=${CURRENT_MAJOR_VERSION}.x&ref=${CURRENT_VERSION}" && curl -v --request POST --header "PRIVATE-TOKEN:${GITLAB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/branches?branch=next-${NEXT_MAJOR_VERSION}.x&ref=${RELEASED_MAJOR_VERSION}"); fi
+    - if [ "$CURRENT_MAJOR_VERSION" -gt 0 ] && [ "$RELEASED_MAJOR_VERSION" -gt "$CURRENT_MAJOR_VERSION" ]; then (curl -v --request POST --header "PRIVATE-TOKEN:${GITLAB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/branches?branch=${CURRENT_MAJOR_VERSION}.x&ref=${CURRENT_VERSION}" && curl -v --request POST --header "PRIVATE-TOKEN:${GITLAB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/branches?branch=next-${NEXT_MAJOR_VERSION}.x&ref=${RELEASED_VERSION}"); fi
   rules:
     # Execute for default branch (should be master/main) and for version branches ('n.x' or 'n.n.x', where n is a number)
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
-- 
GitLab