From 599ccdcb8ab8f73e276197ef9d2a39f92b882e8b Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Wed, 28 Feb 2024 21:28:21 +0100
Subject: [PATCH] feat: Add CI rules for optimised builds

---
 images/.utils/gitlab-ci.yaml | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/images/.utils/gitlab-ci.yaml b/images/.utils/gitlab-ci.yaml
index c3d8c9ceb..76ff7567e 100644
--- a/images/.utils/gitlab-ci.yaml
+++ b/images/.utils/gitlab-ci.yaml
@@ -4,4 +4,18 @@ include:
 container-build:
   extends: .earthly-cloud
   script:
-    - earthly --use-inline-cache --save-inline-cache --ci --push +images
\ No newline at end of file
+    - earthly --use-inline-cache --save-inline-cache --ci +images
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      variables:
+        EARTHLY_PUSH: "true"
+      changes:
+        paths:
+          - images/**/*
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      changes:
+        paths:
+          - images/**/*
+        compare_to: main
+
+
-- 
GitLab