From 31d6ae0b73d01a6ef410105220a6247415d222f3 Mon Sep 17 00:00:00 2001 From: Alex T Date: Fri, 23 Aug 2024 18:56:57 -0600 Subject: [PATCH] Refactoring github actions tagging --- .github/workflows/docker.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b06bfc5..44907f8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,8 +5,6 @@ on: branches: - master - dev - tags: - - 'v*' env: DOCKERHUB_USERNAME: apptality @@ -42,21 +40,26 @@ jobs: username: ${{ env.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 + - name: Build and push (branch) + if: github.ref != 'refs/heads/master' + uses: docker/build-push-action@v6 with: - images: ${{ env.REGISTRY_IMAGE }} + platforms: linux/amd64,linux/arm64 + push: true tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}}.{{minor}}.{{patch}} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.branchName }} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.majorMinor }} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.majorMinorPatch }} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.shortSha }} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.fullSemVer }} - - name: Build and push (branch) - if: github.ref != 'refs/heads/master' + - name: Build and push (master) + if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 push: true - tags: ${{ steps.meta.outputs.tags }} + tags: | + ${{ env.REGISTRY_IMAGE }}:latest + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.majorMinor }} + ${{ env.REGISTRY_IMAGE }}:${{ steps.gitversion.outputs.majorMinorPatch }}