From d51574788bd3fb56003f1efe08717430ffae1a6a Mon Sep 17 00:00:00 2001 From: Wojciech Kapcia Date: Sat, 13 Jul 2024 12:09:46 +0200 Subject: [PATCH] Attempt publishing docker images only if `PUBLISH_DOCKER_IMAGE_ENABLED` variable is set to `true` --- .github/workflows/docker.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b969e69de07..0c20f1de024 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -54,14 +54,14 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: github.event_name != 'pull_request' + if: ${{ github.event_name != 'pull_request' && vars.PUBLISH_DOCKER_IMAGE_ENABLED == 'true' }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - if: github.event_name != 'pull_request' + if: ${{ github.event_name != 'pull_request' && vars.PUBLISH_DOCKER_IMAGE_ENABLED == 'true' }} uses: docker/login-action@v3 with: registry: ghcr.io @@ -69,7 +69,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Quay Container Registry - if: github.event_name != 'pull_request' + if: ${{ github.event_name != 'pull_request' && vars.PUBLISH_DOCKER_IMAGE_ENABLED == 'true' }} uses: docker/login-action@v3 with: registry: quay.io @@ -78,6 +78,7 @@ jobs: - name: Build and Push Alpine images uses: docker/build-push-action@v6 + if: ${{ vars.PUBLISH_DOCKER_IMAGE_ENABLED == 'true' }} with: context: . file: ./packaging/docker/alpine/Dockerfile @@ -87,6 +88,7 @@ jobs: - name: Build and Push Distroless images uses: docker/build-push-action@v6 + if: ${{ vars.PUBLISH_DOCKER_IMAGE_ENABLED == 'true' }} with: context: . file: ./packaging/docker/distroless/Dockerfile