From 49501306356209e18a7f6952f6059081ac9adda4 Mon Sep 17 00:00:00 2001
From: ecasellas <eric.casellas@inrae.fr>
Date: Wed, 25 Jan 2023 12:57:49 +0100
Subject: [PATCH 1/5] fix runner errors

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 64c81d8..7b76915 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,9 +2,9 @@ stages:
   - prepare
   - deploy
 
-image: docker:stable
+image: docker:20.10.20
 services:
-  - docker:dind
+  - docker:20.10.20-dind
 
 variables:
   DOCKER_HOST: tcp://docker:2376
-- 
GitLab


From 4ae01038f440ad9c2f4b18ff195c20e54286900c Mon Sep 17 00:00:00 2001
From: ecasellas <eric.casellas@inrae.fr>
Date: Wed, 25 Jan 2023 13:05:41 +0100
Subject: [PATCH 2/5] ci ajout environements

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7b76915..be2b9e7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 stages:
   - prepare
   - deploy
+  - 🧽 clean
 
 image: docker:20.10.20
 services:
@@ -22,11 +23,39 @@ pub:
 
 pages:
   stage: deploy
-  image: monachus/hugo
+  image: hugo/hugo_extended:0.92.2
   script:
   - hugo
   artifacts:
     paths:
     - public
-  only:
-  - master
+  rules:
+  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+  environment:
+    name: production
+    url: "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/${CI_PROJECT_NAME}"
+  needs: ["pub"]
+
+# Deploy temporary env on MR
+pages:preview:
+  extends: pages
+  artifacts:
+    expire_in: 2 week
+  rules:
+    - if: $CI_MERGE_REQUEST_IID
+  environment:
+    name: preview/${CI_COMMIT_REF_NAME}
+    url: "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts/public/index.html"
+    on_stop: pages:preview:stop
+
+pages:preview:stop:
+  stage: 🧽 clean
+  rules:
+    - if: $CI_MERGE_REQUEST_IID
+      when: manual
+  allow_failure: true
+  environment:
+    name: preview/${CI_COMMIT_REF_NAME}
+    action: stop
+  script:
+    - echo "🧽 clean MR environment [preview/${CI_COMMIT_REF_NAME}]"
\ No newline at end of file
-- 
GitLab


From 8076583b62f1abb7e7eaf908ecf30983750eafc0 Mon Sep 17 00:00:00 2001
From: ecasellas <eric.casellas@inrae.fr>
Date: Wed, 25 Jan 2023 13:08:35 +0100
Subject: [PATCH 3/5] fix baseurl for preview env

---
 config.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.toml b/config.toml
index 3334c89..2be0051 100644
--- a/config.toml
+++ b/config.toml
@@ -1,6 +1,6 @@
-baseURL = "https://eq-record.pages.mia.inra.fr/record-team/"
 languageCode = "en-us"
 theme = "ezhil"
+relativeURLs = true
 
 [languages]
   [languages.fr]
-- 
GitLab


From 1853bd47a4937db2114940e2c60bbb4401a4058b Mon Sep 17 00:00:00 2001
From: ecasellas <eric.casellas@inrae.fr>
Date: Wed, 25 Jan 2023 13:18:49 +0100
Subject: [PATCH 4/5] ci remove needs

---
 .gitlab-ci.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index be2b9e7..d8130cd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -34,7 +34,6 @@ pages:
   environment:
     name: production
     url: "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/${CI_PROJECT_NAME}"
-  needs: ["pub"]
 
 # Deploy temporary env on MR
 pages:preview:
-- 
GitLab


From a0da3ee8669ce1f250b15bf844808b15bebc736e Mon Sep 17 00:00:00 2001
From: ecasellas <eric.casellas@inrae.fr>
Date: Wed, 25 Jan 2023 13:21:37 +0100
Subject: [PATCH 5/5] fix hugo image

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d8130cd..24ca0e3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,7 +23,7 @@ pub:
 
 pages:
   stage: deploy
-  image: hugo/hugo_extended:0.92.2
+  image: registry.gitlab.com/pages/hugo/hugo_extended:0.92.2
   script:
   - hugo
   artifacts:
-- 
GitLab