Skip to content

Commit

Permalink
Updating conditional to build-and-push Github workflow (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
danjbh authored Sep 10, 2020
1 parent d194dd9 commit b6b7d40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: "Checkout source code at current commit"
uses: actions/checkout@v2
- name: Prepare tags for Docker image
if: github.event.pull_request.head.repo.full_name == github.repository
if: (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository
id: prepare
run: |
TAGS=${{ github.repository }}:sha-${GITHUB_SHA:0:7}
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event.pull_request.head.repo.full_name == github.repository
if: (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -43,5 +43,5 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
push: ${{ (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository }}
tags: ${{ steps.prepare.outputs.tags }}

0 comments on commit b6b7d40

Please sign in to comment.