From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sat, 4 Jul 2020 09:28:02 +0000 (+0100) Subject: Only allow steps of workflow to execute if running out of the mikebrady/shairport... X-Git-Tag: 3.3.7rc0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2caafe34e875b0947cfd72f30f8aecfd07a489a;p=thirdparty%2Fshairport-sync.git Only allow steps of workflow to execute if running out of the mikebrady/shairport-sync GitHub repository --- diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 281b631e..cdd0b6f6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,6 +2,9 @@ name: Docker # Thanks to Ryan Govostes for this workflow. +# Using 'if:' conditions, the script will not execute the steps +# unless it is running out of the 'mikebrady/shairport-sync' GitHub repository. + on: push: # Publish `master` as Docker `latest` image. @@ -28,6 +31,7 @@ jobs: # See: https://github.com/crazy-max/ghaction-docker-buildx/issues/134 - name: Prepare id: prepare + if: github.repository == 'mikebrady/shairport-sync' run: | # Map git ref branch or tag name to Docker tag version VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') @@ -48,17 +52,18 @@ jobs: - uses: crazy-max/ghaction-docker-buildx@v1.2.1 - name: Build + if: github.repository == 'mikebrady/shairport-sync' run: | docker buildx build \ --output type=image,push=false \ ${{ steps.prepare.outputs.buildx_args }} - name: Log into registry - if: github.event_name == 'push' + if: github.event_name == 'push' && github.repository == 'mikebrady/shairport-sync' run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login --username $DOCKER_HUB_USER --password-stdin - name: Push to registry - if: github.event_name == 'push' + if: github.event_name == 'push' && github.repository == 'mikebrady/shairport-sync' run: | docker buildx build \ --output type=image,push=true \