Skip to content

Commit 37bbe8c

Browse files
authored
fix: improve Docker image tagging strategy for releases (#70)
- Remove PR-specific tagging to reduce unnecessary image builds - Add semantic versioning tags (major, minor, patch) for releases - Restrict 'latest' tag to only releases instead of main branch pushes - Add version-specific tags only when releases are published
1 parent cb6da68 commit 37bbe8c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/docker-build.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ jobs:
4040
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4141
tags: |
4242
type=ref,event=branch
43-
type=ref,event=pr,prefix=pr-
4443
type=ref,event=tag
45-
type=raw,value=latest,enable={{is_default_branch}}
44+
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
45+
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
46+
type=semver,pattern={{major}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
47+
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
4648
4749
- name: Build and push Docker image
4850
id: build-and-push

0 commit comments

Comments
 (0)