From 41c5e8a02c19e10d9f065740cb7855e9e29d5546 Mon Sep 17 00:00:00 2001
From: proletarius101 <proletarius101@protonmail.com>
Date: Sun, 12 May 2024 19:35:23 +0800
Subject: [PATCH 1/2] ci: disable build jobs when the source is a trigger

---
 .gitlab-ci.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3afffbbf..4954d1b4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -34,6 +34,9 @@ default:
 
 .build_job:
   stage: build
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "trigger"
+      when: never
   tags:
     - saas-linux-large-amd64
   before_script:
@@ -122,7 +125,7 @@ publishInternal:
   before_script:
     - mv $google_play_service_account_api_key_json ~/.google-play.json
     - apk add build-base
-    - "export VERSION_CODE=$CI_PIPELINE_IID && echo $VERSION_CODE"
+    - 'export VERSION_CODE=$CI_PIPELINE_IID && echo $VERSION_CODE'
     # Install fastlane etc.
     - bundle config set path 'vendor/bundle'
     - bundle install -j $(nproc)
-- 
GitLab


From a9ae26e2345baf35ab7b3ed7d7df72cb51759ca2 Mon Sep 17 00:00:00 2001
From: proletarius101 <proletarius101@protonmail.com>
Date: Sun, 12 May 2024 19:44:43 +0800
Subject: [PATCH 2/2] ci: fix the mixed uses of rules: and only:

---
 .gitlab-ci.yml | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4954d1b4..372e3295 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,9 +5,9 @@ include:
     file: android-set-version-ci.yml
 
 .only-release: &only-release
-  only:
-    - master
-    - tags
+  rules:
+    - if: $CI_COMMIT_TAG
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
 
 variables:
   UPSTREAM_BRANCH: dev
@@ -113,8 +113,8 @@ publishInternal:
     paths:
       - .gradle
       - vendor/bundle
-  only:
-    - tags
+  rules:
+    - if: $CI_COMMIT_TAG
 
 .promote_job:
   <<: *only-release
@@ -135,8 +135,8 @@ publishInternal:
     paths:
       - .gradle
       - vendor/bundle
-  only:
-    - tags
+  rules:
+    - if: $CI_COMMIT_TAG
 
 promoteAlpha:
   extends: .promote_job
@@ -155,7 +155,8 @@ promoteProduction:
   stage: production
   # We only allow production promotion on `master` because
   # it has its own production scoped secret variables
-  only:
-    - $CI_DEFAULT_BRANCH
+  rules:
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - when: never
   script:
     - bundle exec fastlane promote_beta_to_production version_code:$VERSION_CODE
-- 
GitLab