From 229ea990bd49941f5084ec6ae0a4e9aaa713f91f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Wed, 13 Sep 2023 20:15:50 +0200
Subject: [PATCH] CI/CD => change "main" branch condition to $CI_DEFAULT_BRANCH

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 65bdf04..1e844b4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,7 +47,7 @@ build:
         # Here docker buildx can use cached images created in previous step
         - docker buildx build --platform $PLATFORMS --file $DOCKERFILE --push --tag $CONTAINER_IMAGE .
     rules:
-        - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /^v[0-9]+(\.[0-9]+)*$/'
+        - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^v[0-9]+(\.[0-9]+)*$/'
 
 release-image:
     stage: release
@@ -57,4 +57,4 @@ release-image:
         - docker buildx imagetools create $CONTAINER_IMAGE --tag $CI_REGISTRY_IMAGE:$VERSION
         - docker buildx imagetools create $CONTAINER_IMAGE --tag $CI_REGISTRY_IMAGE:latest
     rules:
-         - if: '$CI_COMMIT_BRANCH == "main"'
\ No newline at end of file
+         - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
\ No newline at end of file
-- 
GitLab