Skip to content

Commit

Permalink
Refactoring github actions tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsbk committed Aug 24, 2024
1 parent 1c6b142 commit 31d6ae0
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- master
- dev
tags:
- 'v*'

env:
DOCKERHUB_USERNAME: apptality
Expand Down Expand Up @@ -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 }}

0 comments on commit 31d6ae0

Please sign in to comment.