From c1ebb279cad11d25f0d0255c73b697d1c44c0a01 Mon Sep 17 00:00:00 2001 From: Christian Kreibich Date: Wed, 3 Nov 2021 15:22:20 -0700 Subject: [PATCH] Only push CI's Docker images when we're on the main repo --- .github/workflows/docker.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8253d3d4e8..459e81e417 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,6 +27,7 @@ jobs: # Create and boot a loader. This will e.g., provide caching # so we avoid rebuilds of the same image after this step. - uses: docker/setup-buildx-action@v1 + - name: Build uses: docker/build-push-action@v2 with: @@ -43,6 +44,7 @@ jobs: - name: Get version id: version run: echo "::set-output name=RELEASE_VERSION::$(cat VERSION)" + - name: Compute target tag id: target env: @@ -65,15 +67,16 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 - # Secrets for the login are not available for pull requests. - if: github.event_name == 'push' + # Don't publish on forks. Also note that secrets for the login are not + # available for pull requests, so trigger on pushes only. + if: github.repository == 'zeek/zeek' && github.event_name == 'push' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Push # Only publish if we did compute a tag. - if: github.event_name == 'push' && steps.target.outputs.tag != '' + if: github.repository == 'zeek/zeek' && github.event_name == 'push' && steps.target.outputs.tag != '' uses: docker/build-push-action@v2 with: context: ./