From fdd97a2624ce42bbdb7d4a013c814cd63985d851 Mon Sep 17 00:00:00 2001
From: Romain Deville <code@romaindeville.fr>
Date: Thu, 20 May 2021 11:44:41 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Fix=20user=5Fconfig=20docs/.gitl?=
 =?UTF-8?q?ab-ci.yml=20when=20no=20git=20TAG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 user_config/docs/.gitlab-ci.yml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/user_config/docs/.gitlab-ci.yml b/user_config/docs/.gitlab-ci.yml
index 5bab534..0d5b8e6 100644
--- a/user_config/docs/.gitlab-ci.yml
+++ b/user_config/docs/.gitlab-ci.yml
@@ -316,11 +316,12 @@ script_deploy_html: &script_deploy_html
     - *before_script_prepare_deployment
   script:
     - git fetch --all
-    - export LAST_TAG="$(git describe --tags `git rev-list --tags --max-count=1`)"
-    - if [[ -z "${LAST_TAG}" ]]
+    - |
+      if ! git describe --tags `git rev-list --tags --max-count=1`
       then
         export LAST_TAG="-1.-1"
       else
+        export LAST_TAG="$(git describe --tags `git rev-list --tags --max-count=1`)"
         export LAST_TAG="${LAST_TAG/v/}"
         export LAST_TAG="${LAST_TAG%.*}"
       fi
@@ -360,7 +361,7 @@ script_deploy_html: &script_deploy_html
       then
         cp tmp/${RSYNC_PATH}/versions.json tmp/${RSYNC_PATH}/../versions.json
       fi
-    - ln -s "${LAST_TAG}" "latest"
+    - ln -s -- "${LAST_TAG}" "latest"
     - mv "latest" "tmp/${PROJECT_PATH}"
     - echo -e "
       <!DOCTYPE html>\n
-- 
GitLab