Skip to content

Commit 89d7f4b

Browse files
author
nicos_backbase
committed
ci: conditional Docker tagging based on version
1 parent a299eb3 commit 89d7f4b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,21 @@ jobs:
323323
username: ${{ github.actor }}
324324
password: ${{ secrets.GITHUB_TOKEN }}
325325

326-
- name: Extract metadata
327-
id: meta
326+
- name: Extract metadata for 0.x versions
327+
id: meta-prerelease
328+
if: startsWith(needs.semantic-version.outputs.version, '0.')
329+
uses: docker/metadata-action@v5
330+
with:
331+
images: |
332+
${{ secrets.DOCKER_USERNAME }}/repos
333+
ghcr.io/${{ github.repository }}
334+
tags: |
335+
type=semver,pattern={{version}},value=${{ needs.semantic-version.outputs.version }}
336+
type=raw,value=latest
337+
338+
- name: Extract metadata for 1.x+ versions
339+
id: meta-stable
340+
if: "!startsWith(needs.semantic-version.outputs.version, '0.')"
328341
uses: docker/metadata-action@v5
329342
with:
330343
images: |
@@ -342,8 +355,8 @@ jobs:
342355
context: .
343356
platforms: linux/amd64,linux/arm64
344357
push: true
345-
tags: ${{ steps.meta.outputs.tags }}
346-
labels: ${{ steps.meta.outputs.labels }}
358+
tags: ${{ steps.meta-prerelease.outputs.tags || steps.meta-stable.outputs.tags }}
359+
labels: ${{ steps.meta-prerelease.outputs.labels || steps.meta-stable.outputs.labels }}
347360
cache-from: type=gha
348361
cache-to: type=gha,mode=max
349362
provenance: false

0 commit comments

Comments
 (0)