From 5880dcb35fc4b9b1eee60bb0f7e58fd7d816c0f6 Mon Sep 17 00:00:00 2001 From: Thales Pereira <31625914+thcp@users.noreply.github.com> Date: Sun, 12 Jul 2026 22:55:27 +0100 Subject: [PATCH] ci(docker): push :latest when a prerelease is promoted to Latest Listen to release `prereleased` and `released` actions instead of `published`: - prereleased (prerelease published) -> version tag only (e.g. 0.8.0-alpha.6) - released (stable publish, or a prerelease promoted to a full/Latest release) -> version tag + :latest - push to main / manual dispatch -> :edge (unchanged) Using these two actions instead of `published` also avoids a double run on a stable publish (which fires both published and released). --- .github/workflows/docker-publish.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1de5afa..19e948e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -13,7 +13,12 @@ on: push: branches: [main] release: - types: [published] + # prereleased: a prerelease is published -> push the version tag only. + # released: a stable release is published, OR a prerelease is promoted to + # a full/Latest release -> push the version tag AND :latest. + # (Listening to these two instead of `published` avoids a double run on a + # stable publish, which fires both `published` and `released`.) + types: [prereleased, released] # Same as a main push but on demand, from any ref. workflow_dispatch: @@ -61,9 +66,9 @@ jobs: with: images: ${{ env.IMAGE }} tags: | - type=raw,value=latest,enable=${{ github.event_name == 'release' && !github.event.release.prerelease }} - type=raw,value=${{ steps.ver.outputs.value }},enable=${{ github.event_name == 'release' }} type=raw,value=edge,enable=${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} + type=raw,value=${{ steps.ver.outputs.value }},enable=${{ github.event_name == 'release' }} + type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'released' }} - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0