From 4d8a932206dd85c496e0878bf324347fdad058ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire?= <gregoire.kubler@proton.me>
Date: Mon, 15 Jul 2024 17:35:23 +0200
Subject: [PATCH] fix : now deploy jobs only run when creating a tag on a main
 branch

---
 .gitlab/ci/rules.gitlab-ci.yml | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index 71fcdd7..3ebabb2 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -13,10 +13,21 @@
     - when: manual
     - allow_failure: false
 
+# creating release jobs only when merging to main
 .rules:release:
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
-    - if: $CI_COMMIT_TAG
     - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_TAG && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
     - allow_failure: false
 
+
+# deploying created releases
+# when creating a commit tag & previous release job was successful
+.rules:deploy:
+  - when: never
+  - allow_failure: false
+  - if: $CI_COMMIT_TAG && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    when: on_success
+
+
-- 
GitLab