Skip to content

Commit

Permalink
only push packages for Docker builder if we are a push to master
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jan 7, 2021
1 parent 8aa01d4 commit ee3eb50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on: [push, pull_request, workflow_dispatch]
jobs:
containers:
runs-on: ubuntu-latest
env:
PUSH_PACKAGES: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v2
- name: Setup Docker Buildx
Expand All @@ -16,12 +18,14 @@ jobs:
version: latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: ${{ env.PUSH_PACKAGES }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v1
if: ${{ env.PUSH_PACKAGES }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Expand All @@ -37,7 +41,7 @@ jobs:
- name: Build image
uses: docker/build-push-action@v2
with:
push: true
push: ${{ env.PUSH_PACKAGES }}
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./scripts/docker/ubuntu/Dockerfile
Expand Down

0 comments on commit ee3eb50

Please sign in to comment.