From 8338d4b655b4a4aef1f40750ad6afe646279ad84 Mon Sep 17 00:00:00 2001
From: Ole Langbehn <ole.langbehn@inoio.de>
Date: Wed, 12 Mar 2025 17:47:39 +0100
Subject: [PATCH] fix: switch from deprecated only to rules, dont use changes
 rules on manual builds

---
 .gitlab/ci/deploy.yml  | 10 ++++++----
 .gitlab/ci/prepare.yml |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/.gitlab/ci/deploy.yml b/.gitlab/ci/deploy.yml
index cbb5c9e..8eaa42a 100644
--- a/.gitlab/ci/deploy.yml
+++ b/.gitlab/ci/deploy.yml
@@ -82,8 +82,9 @@ deploy:staging:infra:
   environment:
     name: staging
     url: https://staging.moderation.holi.social
-  only:
-    - main
+  rules:
+    - if: $CI_COMMIT_BRANCH == "main"
+      when: on_success
 
 ###
 # PRODUCTION
@@ -94,5 +95,6 @@ deploy:production:infra:
   environment:
     name: production
     url: https://moderation.holi.social
-  only:
-    - production
\ No newline at end of file
+  rules:
+    - if: $CI_COMMIT_BRANCH == "production"
+      when: on_success
diff --git a/.gitlab/ci/prepare.yml b/.gitlab/ci/prepare.yml
index 74df4b0..b9ee338 100644
--- a/.gitlab/ci/prepare.yml
+++ b/.gitlab/ci/prepare.yml
@@ -6,8 +6,10 @@ apps:prepare:
     - corepack enable
     - corepack yarn install --immutable
   rules:
-    # Execute step if yarn.lock was changed or cache is missing
-    # Inspired by https://gitlab.com/gitlab-org/gitlab/-/issues/244932#note_1727726890
+    # always run when triggered manually
+    - if: $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "web"
+      when: on_success
+    # only run on specific file changes when triggered by git push
     - if: $CI_COMMIT_BRANCH
       changes: 
       - yarn.lock
-- 
GitLab