From cac70a5aaace3251eb850b60deb2b2c0919fafab Mon Sep 17 00:00:00 2001 From: Xavier Date: Wed, 7 Oct 2026 08:24:14 +0200 Subject: [PATCH] =?UTF-8?q?ci:=20int=C3=A9gration=20de=20docker/metadata-a?= =?UTF-8?q?ction=20pour=20g=C3=A9n=C3=A9rer=20dynamiquement=20les=20tags?= =?UTF-8?q?=20SemVer=20et=20latest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-docker.yml | 15 ++++++++++++++- .github/workflows/docker.yml | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build-docker.yml b/.gitea/workflows/build-docker.yml index 73dac36..100f176 100644 --- a/.gitea/workflows/build-docker.yml +++ b/.gitea/workflows/build-docker.yml @@ -4,6 +4,8 @@ on: push: branches: - main + tags: + - 'v*' # Déclenche aussi le pipeline lors de la création d'un tag jobs: build-and-push: @@ -16,6 +18,16 @@ jobs: - name: Checkout du code uses: actions/checkout@v3 + # NOUVEAU : Génération dynamique des tags (SemVer + Latest) + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: gitea.aethas38.duckdns.org/xavier/multi-ia-codage + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + - name: Connexion au registre Gitea uses: docker/login-action@v2 with: @@ -28,4 +40,5 @@ jobs: with: context: . push: true - tags: gitea.aethas38.duckdns.org/xavier/multi-ia-codage:latest \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b313482..cc9cea3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,8 @@ name: Build and Publish Docker Image on: push: - branches: [ "main" ] # Modifiez si votre branche s'appelle "master" + branches: [ "main" ] + tags: [ 'v*' ] # Déclencheur sur les tags ajouté ici aussi env: REGISTRY: ghcr.io @@ -13,12 +14,22 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - packages: write # Indispensable pour publier le paquet sur le dépôt + packages: write steps: - name: Checkout du code uses: actions/checkout@v4 + # NOUVEAU : Identique à Gitea, gère ghcr.io + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + - name: Connexion au registre GitHub (ghcr.io) uses: docker/login-action@v3 with: @@ -31,4 +42,5 @@ jobs: with: context: . push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file