diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0d7fc6..f22a0a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: env: DOCKER_REPO: sippylabs/webrtc_phone BASE_IMAGE: sippylabs/rtpproxy:RFC5245_ICE-ubuntu_latest + DOCKER_RW: ${{ ( github.repository == 'sippy/webrtc_phone' && github.event_name != 'pull_request' ) && 'true' || 'false' }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -64,7 +65,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub - if: github.event_name != 'pull_request' + if: ${{ env.DOCKER_RW }} uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -97,7 +98,7 @@ jobs: context: . file: ./Dockerfile build-args: BASE_IMAGE=${{ env.BASE_IMAGE }} - push: true + push: ${{ env.DOCKER_RW }} tags: | ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -106,7 +107,7 @@ jobs: cache-to: ${{ env.CACHE_SPEC }},mode=max - name: Update DockerHub repo description - if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + if: ${{ env.DOCKER_RW }} && ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}