Skip to content

Commit 7cc8aae

Browse files
author
Chun-Hung Tseng
committed
Add conditions for pushing images from GithubCI to DockerHub
This commit restricts the condition for GithubCI to push the docker image to DockerHub, so the pull requests will perform the GithubCI build runs but it won't pollute the DockerHub images by pushing the built images up there.
1 parent 70c0785 commit 7cc8aae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/docker.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: docker/setup-buildx-action@v3
2121
- name: Login to Docker Hub
2222
uses: docker/login-action@v3
23+
if: github.event_name == 'push'
2324
with:
2425
username: ${{ secrets.DOCKERHUB_USERNAME }}
2526
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
@@ -28,5 +29,5 @@ jobs:
2829
with:
2930
context: .
3031
platforms: linux/amd64,linux/arm64
31-
push: true
32-
tags: sysprog21/chisel-bootcamp:latest
32+
push: ${{ github.event_name == 'push' }}
33+
tags: sysprog21/chisel-bootcamp:latest

0 commit comments

Comments
 (0)