From 68c45044f77f464ac00e26fc0a8a32140ac08089 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Wed, 13 Sep 2023 20:50:32 +0200
Subject: [PATCH] CI/CD => Get env file from specifiq version uploaded in
 protected files

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eca9aaf..0507bcd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,8 @@
+variables:
+    GIT_SUBMODULE_STRATEGY: recursive
+    GIT_SUBMODULE_FORCE_HTTPS: "true"
+    SECURE_FILES_DOWNLOAD_PATH: './'
+
 stages:
     - deploy
 
@@ -6,15 +11,15 @@ deploy:
     stage: deploy
     tags:
         - dojo_backend_deployment
-    variables:
-        GIT_SUBMODULE_STRATEGY: recursive
-        GIT_SUBMODULE_FORCE_HTTPS: "true"
-        SECURE_FILES_DOWNLOAD_PATH: './'
     script:
+        - apk update
+        - apk add jq
+        - >
+            VERSION=$(jq -r .version API/package.json)
         # Download secure files
         - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
         # Prepare environment
-        - mv env .env
+        - mv env_$VERSION .env
         - cp .env API/.env
         # Deploy
         - ./infra --run
-- 
GitLab