chore: Only tag images with branchname if changes are on master branch

This commit is contained in:
Noah 2025-10-13 17:27:26 +02:00
parent 9f582e4c75
commit 22c01b54b8
No known key found for this signature in database
GPG key ID: D2A7E2C8F77E0430

View file

@ -8,6 +8,7 @@ on:
- 'go.sum'
- 'Dockerfile'
- '.github/workflows/**'
jobs:
docker:
runs-on: ubuntu-latest
@ -21,8 +22,8 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
@ -30,5 +31,5 @@ jobs:
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/riscv64
push: true
tags: |
${{ github.repository }}:${{ github.ref_name }}
${{ github.repository }}:commit-${{ github.sha }}
${{ github.ref_name == 'master' && format('{0}:{1}', github.repository, github.ref_name) || '' }}