From 6989ff55a15be125ee3817742316e30b5476ff4a Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Wed, 1 Jul 2020 17:02:16 +0200
Subject: [PATCH] adaptations for new deployment system

---
 .ci/deploy.sh  | 23 +----------------------
 .gitlab-ci.yml | 11 ++++++++++-
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/.ci/deploy.sh b/.ci/deploy.sh
index 17d4410e..fd7f55c5 100644
--- a/.ci/deploy.sh
+++ b/.ci/deploy.sh
@@ -9,15 +9,6 @@ echo $rootDir
 rm -rf $rootDir/public
 mkdir $rootDir/public
 
-# 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
 for d in $(find . -maxdepth 1 -type d)
@@ -35,7 +26,6 @@ do
 
                 # create the required folders in public
                 mkdir $rootDir/public/$BLADE
-                mkdir $rootDir/public/$BLADE/$version
 
                 # change to the blade directory to be built
                 cd $BLADE
@@ -54,21 +44,10 @@ do
                 yarn install
 
                 grunt dist
-                mv public/* $rootDir/public/$BLADE/$version/.
+                mv public/* $rootDir/public/$BLADE/.
 
                 echo " > latest built for file set ${BLADE}"
 
-                # auto redirect file to the stable version
-                echo '<html>\n
-                    <head>\n
-                    <meta http-equiv="refresh" content="0; url='$PAGEURL'/'$BLADE'/stable"/>\n
-                    </head>\n
-                    <body>\n
-                    </bod>\n
-                    </html>\n' > $rootDir/public/$BLADE/index.html
-
-                echo "autoredirect file set"
-
                 # move back out
                 cd ..
                 echo " > -----------------------------------------------------"
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 16e11393..22fa50be 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,6 +25,14 @@ production:
   stage: deploy
   image: alpine:3.1
   before_script:
+    # define the branch
+    - if [[ $CI_COMMIT_BRANCH == "develop" ]]; then
+          version="latest"
+      elif [[ $CI_COMMIT_BRANCH == "master" ]]; then
+          version="stable"
+      else
+          version="unstable"
+      fi
     - 'which ssh-agent || ( apk add --update openssh )'
     - eval $(ssh-agent -s)
     - echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
@@ -36,4 +44,5 @@ production:
     - if: '$CI_COMMIT_BRANCH == "develop"'
   script:
     - ssh -p $SSHPORT $SSHCONNECT "rm -rf ~/web/latest/*"
-    - scp -P $SSHPORT -r public/* $SSHCONNECT:~/web/latest
+    - ssh -p $SSHPORT $SSHCONNECT "mkdir ~/web/latest/$version"
+    - scp -P $SSHPORT -r public/* $SSHCONNECT:~/web/latest/$version
-- 
GitLab