diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2c792d0b8326866896c1edfa55e6a7a2e280f60d..71dd9c2eec64e126483087df4296af7427160848 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,25 @@
 stages:
-  - deploy
+  - setup
+  - trigger
 
-re-tag:
-  stage: deploy
+generate-config:
+  stage: setup
+  before_script:
+    - docker login $CI_REGISTRY
   script:
-    - echo TRIGGER_PAYLOAD=$TRIGGER_PAYLOAD
-    - cat $TRIGGER_PAYLOAD
-
+    - bash ./generate-deploy-stages.sh
+  artifacts:
+    paths:
+      - deploy.yml
+  only:
+    refs:
+      - main
   tags:
-    - shell
\ No newline at end of file
+    - shell
+
+deploy_image_trigger:
+  stage: trigger
+  trigger:
+    include:
+      - artifact: deploy.yml
+        job: generate-config