From 34eead4161de8608ab1d4434f36b24f82b0be502 Mon Sep 17 00:00:00 2001 From: micha37-martins Date: Thu, 12 Sep 2024 19:50:23 +0200 Subject: [PATCH] chore: add tag to ghcr package --- .github/workflows/github-workflow.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/github-workflow.yaml b/.github/workflows/github-workflow.yaml index 76bf706..f029de0 100644 --- a/.github/workflows/github-workflow.yaml +++ b/.github/workflows/github-workflow.yaml @@ -8,6 +8,8 @@ on: branches: - master - dev + tags: + - "*.*.*" jobs: coverage: @@ -78,6 +80,21 @@ jobs: permissions: packages: write steps: + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + micha37-martins/smartmon + ghcr.io/micha37-martins/smartmon + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - name: Checkout code uses: actions/checkout@v3.6.0 @@ -95,11 +112,9 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker container - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true - tags: | - ghcr.io/${{ github.repository_owner }}/smartmon:latest - ghcr.io/${{ github.repository_owner }}/smartmon:${{ steps.latest_tag.outputs.tag }} + tags: ${{ steps.meta.outputs.tags }}