From f39a673b8771480df72c0a33bd1b2faa17e9273c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 2 Sep 2022 11:33:58 +0200
Subject: [PATCH] fix(ci): index.html base href not modified in case of devel
 deployment to OVH

refs devel
---
 .gitlab-ci.yml            | 2 +-
 scripts/deploy-version.sh | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 58a0f807d..48c33d73f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -123,7 +123,7 @@ deploy-ovh-dev:
     - build
   script:
     # Copie de la branche / du tag
-    - ./scripts/deploy-version.sh prod $PROD_LOGIN $PROD_HOST $PROD_DEV_PATH
+    - ./scripts/deploy-version.sh prod-devel $PROD_LOGIN $PROD_HOST $PROD_DEV_PATH
 
 deploy-prod:
   stage: deploy-prod
diff --git a/scripts/deploy-version.sh b/scripts/deploy-version.sh
index 1b44ee652..4f05359f9 100755
--- a/scripts/deploy-version.sh
+++ b/scripts/deploy-version.sh
@@ -17,12 +17,16 @@ DIR="$4"
 
 echo "$(basename $0): deploying version $VERSION in $LOGIN@$HOST:$DIR"
 
-if [[ $VERSION == "prod" ]]; then
+if [[ $VERSION == "prod" || $VERSION == "prod-devel" ]]; then
   # Copie de la branche production
   rsync -a --delete --exclude=cassiopee-releases -e "ssh -o StrictHostKeyChecking=no" dist/ ${LOGIN}@${HOST}:${DIR}/
   # Modification du dossier base href
   echo "updating index.html"
-  ssh $LOGIN@$HOST "sed -i 's:/cassiopee/stable/:/:g' $DIR/index.html"
+  if [[ $VERSION == "prod" ]]; then
+    ssh $LOGIN@$HOST "sed -i 's:/cassiopee/stable/:/:g' $DIR/index.html"
+  else
+    ssh $LOGIN@$HOST "sed -i 's:/cassiopee/devel/:/:g' $DIR/index.html"
+  fi
 else
   # Copie de la branche / du tag
   rsync -a --delete --exclude=cassiopee-releases -e "ssh -o StrictHostKeyChecking=no" "dist/" "$LOGIN@$HOST:$DIR/$VERSION"
-- 
GitLab