From 4dc89e3ad1125c7f9c0177db9d92a4f4b26bdfea Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Wed, 1 Jul 2020 14:58:40 +0200
Subject: [PATCH] set folder named based on branch

---
 .ci/deploy.sh | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/.ci/deploy.sh b/.ci/deploy.sh
index ffe716af..17d4410e 100644
--- a/.ci/deploy.sh
+++ b/.ci/deploy.sh
@@ -9,11 +9,14 @@ echo $rootDir
 rm -rf $rootDir/public
 mkdir $rootDir/public
 
-# create img folders
-#mkdir $rootDir/public/img
-#mkdir $rootDir/public/img/unstable
-#mkdir $rootDir/public/img/latest
-#mkdir $rootDir/public/img/stable
+# define the branch
+if [[ $CI_COMMIT_BRANCH == "develop" ]]; then
+    version="latest"
+elif [[ $CI_COMMIT_BRANCH == "master" ]]; then
+    version="stable"
+else
+    version="unstable"
+fi
 
 # loop through all the presentations
 nBlades=0
@@ -32,9 +35,7 @@ do
 
                 # create the required folders in public
                 mkdir $rootDir/public/$BLADE
-                #mkdir $rootDir/public/$BLADE/unstable
-                mkdir $rootDir/public/$BLADE/latest
-                #mkdir $rootDir/public/$BLADE/stable
+                mkdir $rootDir/public/$BLADE/$version
 
                 # change to the blade directory to be built
                 cd $BLADE
@@ -53,7 +54,7 @@ do
                 yarn install
 
                 grunt dist
-                mv public/* $rootDir/public/$BLADE/latest/.
+                mv public/* $rootDir/public/$BLADE/$version/.
 
                 echo " > latest built for file set ${BLADE}"
 
-- 
GitLab