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