From 0e905955b43932c3e05d6571910bf75625a055e6 Mon Sep 17 00:00:00 2001
From: Guillaume Lapierre <g.lapierre@senat.fr>
Date: Fri, 8 Nov 2024 12:16:09 +0100
Subject: [PATCH] build: change docker tags + rebuild latest release

---
 .gitea/workflows/build.yaml        |  2 +-
 .gitea/workflows/lastreleased.yaml | 23 ++++++++++++++++++-----
 .gitea/workflows/nightly.yaml      |  4 ++--
 .gitea/workflows/publish.yaml      |  4 ++--
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml
index 9695957..67433de 100644
--- a/.gitea/workflows/build.yaml
+++ b/.gitea/workflows/build.yaml
@@ -2,7 +2,7 @@
 # Build docker image
 #
 
-name: BuildMain
+name: Build Main
 run-name: ${{ gitea.actor }} running CI in the pipeline 🚀
 on: [ push ]
 
diff --git a/.gitea/workflows/lastreleased.yaml b/.gitea/workflows/lastreleased.yaml
index 7d0f36c..1697ac2 100644
--- a/.gitea/workflows/lastreleased.yaml
+++ b/.gitea/workflows/lastreleased.yaml
@@ -2,7 +2,7 @@
 # Build docker image for last released version
 #
 
-name: BuildTag
+name: Rebuild Last Released
 run-name: ${{ gitea.actor }} running CI in the pipeline 🚀
 on:
   push:
@@ -22,9 +22,22 @@ jobs:
       - name: Get the latest tag
         id: get_last_tag
         run: echo "LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
-      - name: Get LAST_TAG
-        run: |
-          set -x 
-          echo "${{ steps.get_last_tag.outputs.LAST_TAG }}"
       - name: Checkout latest version
         run: git checkout ${{ steps.get_last_tag.outputs.LAST_TAG }}
+      - name: Set up docker buildx
+        uses: docker/setup-buildx-action@v3
+        with:
+          driver-opts: |
+            network=giteanet
+      - name: Login to Docker Hub
+        uses: docker/login-action@v3
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push version
+        uses: docker/build-push-action@v5
+        env:
+          ACTIONS_RUNTIME_TOKEN: ''
+        with:
+          push: true
+          tags: zeguigui/open-report-analyzer:${{ steps.get_last_tag.outputs.LAST_TAG }},zeguigui/open-report-analyzer:latest
\ No newline at end of file
diff --git a/.gitea/workflows/nightly.yaml b/.gitea/workflows/nightly.yaml
index a878c7f..d1cd5c3 100644
--- a/.gitea/workflows/nightly.yaml
+++ b/.gitea/workflows/nightly.yaml
@@ -2,7 +2,7 @@
 # Build docker image
 #
 
-name: BuildTag
+name: Nightly build
 run-name: ${{ gitea.actor }} running CI in the pipeline 🚀
 on:
   schedule:
@@ -32,4 +32,4 @@ jobs:
           ACTIONS_RUNTIME_TOKEN: ''
         with:
           push: true
-          tags: zeguigui/open-report-analyzer:latest
\ No newline at end of file
+          tags: zeguigui/open-report-analyzer:nightly
\ No newline at end of file
diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml
index dd5ee3d..a60cd70 100644
--- a/.gitea/workflows/publish.yaml
+++ b/.gitea/workflows/publish.yaml
@@ -2,7 +2,7 @@
 # Build docker image
 #
 
-name: BuildTag
+name: Build Tag
 run-name: ${{ gitea.actor }} running CI in the pipeline 🚀
 on:
   push:
@@ -33,4 +33,4 @@ jobs:
           ACTIONS_RUNTIME_TOKEN: ''
         with:
           push: true
-          tags: zeguigui/open-report-analyzer:${{ gitea.ref_name }}
\ No newline at end of file
+          tags: zeguigui/open-report-analyzer:${{ gitea.ref_name }},zeguigui/open-report-analyzer:latest
\ No newline at end of file