From 5ded5310e7365c2319d8cefbe17deb18c87cec74 Mon Sep 17 00:00:00 2001 From: Brendon Smith Date: Mon, 27 May 2024 14:39:55 -0400 Subject: [PATCH] Add `workflow_dispatch` trigger for Docker builds --- .github/workflows/build-and-push-docker-image.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index 417891c..f39a715 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -6,7 +6,12 @@ on: # yamllint disable-line rule:truthy pull_request: push: branches: ["release/*", "unstable/*"] - tags: ["*"] + workflow_dispatch: + inputs: + tag: + description: Docker image tag + required: true + type: string jobs: build-and-push: @@ -16,12 +21,14 @@ jobs: - uses: actions/checkout@v4 - name: Build Docker image run: | - IMAGE="ghcr.io/$GITHUB_REPOSITORY:${GITHUB_REF_NAME/'/'/'-'}" + IMAGE="ghcr.io/$GITHUB_REPOSITORY:${DOCKER_TAG/'/'/'-'}" echo "IMAGE=$IMAGE" >>"$GITHUB_ENV" docker build . \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --cache-from $IMAGE \ --tag $IMAGE + env: + DOCKER_TAG: ${{ inputs.tag || github.ref_name }} - name: Log in to GHCR if: github.event_name != 'pull_request' run: >-