forked from mikebrady/shairport-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only allow steps of workflow to execute if running out of the mikebra…
…dy/shairport-sync GitHub repository
- Loading branch information
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ name: Docker | |
|
||
# Thanks to Ryan Govostes <https://github.com/rgov> 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/[email protected] | ||
|
||
- 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 \ | ||
|