From bff2bd725a50f38b129cde3b5731181b09256af5 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Wed, 1 Jun 2022 13:38:30 +0200
Subject: [PATCH] feat(ci): handle host tags

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ef90d70a8..54c9223f2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -94,7 +94,7 @@ build_debug_with_cache:
 build_release:
   extends: .env
   rules:
-    - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH =~ /^release/"
+    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
     - when: never
   stage: build
   script:
@@ -109,6 +109,8 @@ build_release:
 build_release_manual:
   extends: .env
   rules:
+    - if: $CI_COMMIT_TAG
+      when: never
     - when: manual
   stage: build
   allow_failure: true
@@ -151,7 +153,7 @@ tests_debug:
 tests_release:
   extends: .env
   rules:
-    - if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH =~ /^release/"
+    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
     - when: never
   stage: tests
   variables:
@@ -219,6 +221,8 @@ deploy_docker_debug_sha:
 deploy_docker_release_sha:
   extends: .docker-build-app-image
   rules:
+    - if: $CI_COMMIT_TAG
+      when: never
     - when: manual
   allow_failure: true
   variables:
@@ -226,3 +230,18 @@ deploy_docker_release_sha:
     IMAGE_TAG: "sha-$CI_COMMIT_SHORT_SHA"
   dependencies:
     - build_release_manual
+
+deploy_docker_release_tag:
+  extends: .docker-build-app-image
+  rules:
+    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
+    - when: never
+  variables:
+    DOCKERFILE_PATH: "docker/Dockerfile"
+    IMAGE_TAG: "$CI_COMMIT_TAG"
+  after_script:
+    - docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
+    - docker tag "duniter/duniter-v2s:$IMAGE_TAG" "duniter/duniter-v2s:latest"
+    - docker push "duniter/duniter-v2s:latest"
+  dependencies:
+    - build_release
-- 
GitLab