From 7e96e0939ec96761e9f29ab3f335383a1b52a67b Mon Sep 17 00:00:00 2001
From: Philippe Ruiz <philippe.ruiz@inrae.fr>
Date: Mon, 6 Jan 2025 10:59:16 +0100
Subject: [PATCH] changes rules to build the doc in function of commit tag

---
 .gitlab-ci.yml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ca34f57a..d98c582a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,8 +8,19 @@ stages:
  - deploy
 
 build_docs:
-  stage: build_docs
+
   image: python:3.8.10-slim
+  rules:
+    - if: "$CI_COMMIT_TAG == null"
+      variables:                              # Override IMAGE_LABEL defined
+          IMAGE_LABEL: "${CI_COMMIT_BRANCH}_${CI_COMMIT_SHORT_SHA}"  # at the job level.
+      when: manual
+    - if: "$CI_COMMIT_TAG != null"
+      variables:                              # Override IMAGE_LABEL defined
+          IMAGE_LABEL: "$CI_COMMIT_TAG"  # at the job level.
+      when: always
+      
+  stage: build_docs
   script:
     - pip install -r docs/requirements.txt
     - sphinx-build -b html docs/source/ build/html
@@ -18,7 +29,6 @@ build_docs:
       - build/html
   only:
     - master
-    - devel
 
 singularity-image-metag:
    variables:
@@ -70,4 +80,3 @@ pages:
       - public
   only:
     - master
-    - devel 
-- 
GitLab