From 1be16107a1a571407e158a264c4ec773e1b2c5ec Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Sun, 3 Nov 2024 13:29:03 +0100 Subject: [PATCH 1/4] Add a way to push the images manually --- .github/workflows/docker-ghcrio.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-ghcrio.yml b/.github/workflows/docker-ghcrio.yml index e4b0bae22..d007c283f 100644 --- a/.github/workflows/docker-ghcrio.yml +++ b/.github/workflows/docker-ghcrio.yml @@ -1,7 +1,13 @@ name: Upload Docker images to ghcr.io on: release: - types: [published, edited] + types: [published] + workflow_dispatch: + inputs: + ref: + description: 'Git tag to push the image' + required: true + type: string jobs: docker: name: Build image @@ -9,6 +15,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} - name: Docker meta id: meta uses: docker/metadata-action@v5 From bcd628647e7ccada958361f5d4c69174911753b9 Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Sun, 3 Nov 2024 13:46:01 +0100 Subject: [PATCH 2/4] Use conditional context for the manual workflow running --- .github/workflows/docker-ghcrio.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-ghcrio.yml b/.github/workflows/docker-ghcrio.yml index d007c283f..908570ac5 100644 --- a/.github/workflows/docker-ghcrio.yml +++ b/.github/workflows/docker-ghcrio.yml @@ -21,6 +21,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: + context: ${{ inputs.ref && 'git' || 'workflow' }} images: ghcr.io/${{ github.repository }} # create latest tag for branch events flavor: | From b7714f9d9659a374be621592fb49397a1d9598ba Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Sun, 3 Nov 2024 17:35:21 +0100 Subject: [PATCH 3/4] Use custom value for the manual launch --- .github/workflows/docker-ghcrio.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-ghcrio.yml b/.github/workflows/docker-ghcrio.yml index 908570ac5..df11178b5 100644 --- a/.github/workflows/docker-ghcrio.yml +++ b/.github/workflows/docker-ghcrio.yml @@ -27,11 +27,9 @@ jobs: flavor: | latest=auto tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{version}},value=${{inputs.ref}} + type=semver,pattern={{major}}.{{minor}},value=${{inputs.ref}} + type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{inputs.ref}} - name: Login to ghcr.io uses: docker/login-action@v3 with: From 80e7cf9c03eb8b911fa4723943a40c7bae2050ff Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Sun, 3 Nov 2024 17:53:09 +0100 Subject: [PATCH 4/4] Create the latest ONLY for the automatic releases --- .github/workflows/docker-ghcrio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-ghcrio.yml b/.github/workflows/docker-ghcrio.yml index df11178b5..aa9973892 100644 --- a/.github/workflows/docker-ghcrio.yml +++ b/.github/workflows/docker-ghcrio.yml @@ -25,7 +25,7 @@ jobs: images: ghcr.io/${{ github.repository }} # create latest tag for branch events flavor: | - latest=auto + latest=${{ inputs.ref && 'false' || 'auto' }} tags: | type=semver,pattern={{version}},value=${{inputs.ref}} type=semver,pattern={{major}}.{{minor}},value=${{inputs.ref}}