Skip to content

Commit 7b26b5e

Browse files
fmoessbauerjan-kiszka
authored andcommitted
ci: only tag container with newest tag with latest-release
When rebuilding existing git tags, we must only tag the container with the "biggest" version with "latest-release". This is especially important once we add bugfix versions, as these would overwrite the tag otherwise. Signed-off-by: Felix Moessbauer <[email protected]> Signed-off-by: Jan Kiszka <[email protected]>
1 parent 3b6461b commit 7b26b5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
deploy-user: ${{ github.actor }}
2929
deploy-token: ${{ secrets.GITHUB_TOKEN }}
3030
image-name: ${{ matrix.image-name }}
31+
- name: Find latest tag
32+
run: echo "LATEST_TAG=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_ENV
3133
- name: Build ${{ matrix.image-name }} image
3234
uses: docker/build-push-action@v6
3335
id: push
@@ -42,7 +44,7 @@ jobs:
4244
outputs: type=registry,rewrite-timestamp=true
4345
tags: |
4446
ghcr.io/${{ github.repository }}/${{ matrix.image-name }}:${{ env.RELEASE_VERSION }}
45-
ghcr.io/${{ github.repository }}/${{ matrix.image-name }}:latest-release
47+
${{ github.ref_name == env.LATEST_TAG && format('ghcr.io/{0}/{1}:latest-release', github.repository, matrix.image-name) || '' }}
4648
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
4749
- name: Attest ${{ matrix.image-name }} image
4850
uses: actions/attest-build-provenance@v1

0 commit comments

Comments
 (0)