From 89ac4979f2f33808399961337ba66c27aed95adb Mon Sep 17 00:00:00 2001
From: Yassine Doghri <yassine@doghri.fr>
Date: Tue, 25 May 2021 09:02:23 +0000
Subject: [PATCH] ci: increase artifacts expire_in for dependencies +
 reorganise bundle & release jobs

---
 .gitlab-ci.yml            | 24 +++++++++++++-----------
 scripts/bundle-prepare.sh |  2 +-
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0729c60229..10f35381a8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,7 +14,7 @@ php-dependencies:
   artifacts:
     paths:
       - vendor/
-    expire_in: 15 mins
+    expire_in: 30 mins
 
 js-dependencies:
   stage: prepare
@@ -24,7 +24,7 @@ js-dependencies:
   artifacts:
     paths:
       - node_modules/
-    expire_in: 15 mins
+    expire_in: 30 mins
 
 lint-commit-msg:
   stage: quality
@@ -68,13 +68,15 @@ tests:
 
 bundle:
   stage: bundle
+  before_script:
+    # prepare dependencies before bundling
+    - chmod +x ./scripts/bundle-prepare.sh
+    - ./scripts/bundle-prepare.sh
   script:
     # make scripts/bundle.sh executable
-    - chmod +x ./scripts/bundle-prepare.sh
     - chmod +x ./scripts/bundle.sh
 
     # bundle castopod-host with commit ref as version
-    - ./scripts/bundle-prepare.sh
     - ./scripts/bundle.sh ${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}
   dependencies:
     - php-dependencies
@@ -90,18 +92,18 @@ bundle:
 
 release:
   stage: release
+  before_script:
+    # IMPORTANT: delete local git tags before release to prevent eventual script failure (ie. tag already exists)
+    - git tag | xargs git tag -d
+
+    # prepare dependencies before release, both bundle and package scripts will be run by semantic-release
+    - chmod +x ./scripts/bundle-prepare.sh
+    - ./scripts/bundle-prepare.sh
   script:
     # make release scripts executable
-    - chmod +x ./scripts/bundle-prepare.sh
     - chmod +x ./scripts/bundle.sh
     - chmod +x ./scripts/package.sh
 
-    # prepare bundle before release, both bundle and package scripts will be run by semantic-release
-    - ./scripts/bundle-prepare.sh
-
-    # IMPORTANT: delete local git tags before release to prevent eventual script failure (ie. tag already exists)
-    - git tag | xargs git tag -d
-
     # run semantic-release script (configured in `.releaserc.json` file)
     - npm run release
   dependencies:
diff --git a/scripts/bundle-prepare.sh b/scripts/bundle-prepare.sh
index d75aea226d..fb2630cb8d 100644
--- a/scripts/bundle-prepare.sh
+++ b/scripts/bundle-prepare.sh
@@ -3,5 +3,5 @@
 # install only production dependencies using the --no-dev option
 php composer.phar install --no-dev --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
 
-# build all production UI assets
+# build all production static assets (css, js, images, icons, fonts, etc.)
 npm run build
-- 
GitLab