From 7cc8aaed843065d596f6e20439cc837445dd7838 Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Mon, 13 Nov 2023 13:54:12 +0100 Subject: [PATCH] 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. --- .github/workflows/docker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4fd6d74..b5e237c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,6 +20,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 + if: github.event_name == 'push' with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} @@ -28,5 +29,5 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - push: true - tags: sysprog21/chisel-bootcamp:latest \ No newline at end of file + push: ${{ github.event_name == 'push' }} + tags: sysprog21/chisel-bootcamp:latest