Skip to content

Commit

Permalink
Attempt publishing docker images only if `PUBLISH_DOCKER_IMAGE_ENABLE…
Browse files Browse the repository at this point in the history
…D` variable is set to `true`
  • Loading branch information
woj-tek committed Jul 15, 2024
1 parent 4ca19d1 commit d515747
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ 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
username: ${{ github.repository_owner }}
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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d515747

Please sign in to comment.