Skip to content

Commit f65e342

Browse files
committed
ci: Use automatic tag management for docker images
Signed-off-by: Phoevos Kalemkeris <[email protected]>
1 parent 28a63bd commit f65e342

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/docker.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: Build and push Docker images
22

33
on:
44
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
5+
branches:
6+
- main
7+
tags:
8+
- "v*.*.*"
89
workflow_dispatch:
910

1011
env:
@@ -61,6 +62,12 @@ jobs:
6162
uses: docker/metadata-action@v5
6263
with:
6364
images: ${{ matrix.image }}
65+
tags: |
66+
type=ref,event=branch
67+
type=semver,pattern={{version}}
68+
type=semver,pattern={{major}}.{{minor}}
69+
type=semver,pattern={{major}}
70+
type=sha
6471
6572
- name: Build and push ${{ matrix.service }}
6673
uses: docker/build-push-action@v6
@@ -69,9 +76,7 @@ jobs:
6976
context: .
7077
file: ${{ matrix.dockerfile }}
7178
push: true
72-
tags: |
73-
${{ steps.meta.outputs.tags }}
74-
${{ matrix.image }}:latest
79+
tags: ${{ steps.meta.outputs.tags }}
7580
labels: ${{ steps.meta.outputs.labels }}
7681
cache-from: type=local,src=/tmp/.buildx-cache
7782
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

0 commit comments

Comments
 (0)