From 38122b2d3f2a55f475c646cd1666fe97770b63ba Mon Sep 17 00:00:00 2001 From: cmdoret Date: Mon, 10 Aug 2026 13:42:54 +0200 Subject: [PATCH] ci(docker): pass push and tags as inputs --- .github/workflows/docker.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 31a1252..a67605f 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,5 +1,5 @@ name: docker -# Reusable: build one image and push it to GHCR (push skipped on pull requests). +# Build one image and push it to GHCR. Push and tags optional. on: workflow_call: inputs: @@ -11,6 +11,16 @@ on: description: "Build context directory" required: true type: string + tag: + description: "Extra tag to publish, e.g. pr-12-a1b2c3d. Empty to rely on the tags derived from the ref." + required: false + default: "" + type: string + push: + description: "Push to GHCR. False builds only, which still checks the Dockerfile." + required: false + default: false + type: boolean jobs: build-and-push: @@ -22,6 +32,7 @@ jobs: - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 + if: inputs.push with: registry: ghcr.io username: ${{ github.actor }} @@ -34,11 +45,11 @@ jobs: tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=tag - type=ref,event=pr + type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }} - uses: docker/build-push-action@v6 with: context: ${{ inputs.context }} - push: ${{ github.event_name != 'pull_request' }} + push: ${{ inputs.push }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}