From 10a9764fc622991353df3fff0cf085241b323af9 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Bayle <j2b.bayle@gmail.com>
Date: Thu, 27 Oct 2022 10:02:20 +0100
Subject: [PATCH] Fix automatic latest tagging

---
 .gitlab-ci.yml | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a9922c0..509940d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -44,14 +44,15 @@ dist:
 
 tag-latest:
   stage: deploy
-  image: alpine/git
-  script:
+  image: datamachines/git-lfs
+  before_script:
+    - git config http.sslverify false
     - git config user.email "${GITLAB_USER_EMAIL}"
     - git config user.name "${GITLAB_USER_NAME}"
-    - git remote add tag-origin https://oauth2:${GITLAB_ACCESS_TOKEN}@gitlab.in2p3.fr/${CI_PROJECT_PATH}
-    - git push --delete tag-origin latest
-    - git tag latest
-    - git push tag-origin latest
+    - git remote set-url origin https://gitlab-ci:${GITLAB_CI_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
+  script:
+    - git tag --force latest
+    - git push --force origin latest
   rules:
     - if: '$CI_COMMIT_TAG =~ /^v\d+(?:\.\d+){0,2}$/'
 
-- 
GitLab