Only run Docker CI stages when necessary.

Instead of building the image all the time, and only pushing if
necessary.
This commit is contained in:
projectmoon 2020-08-31 22:30:44 +00:00
parent ae6922dd6c
commit 16a9aeebcd
1 changed files with 2 additions and 5 deletions

View File

@ -30,7 +30,7 @@ jobs:
needs: build_and_test
runs-on: ubuntu-latest
if: github.event_name == 'push'
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout code
@ -43,13 +43,12 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
repository: projectmoon/chronicle-dicebot
tags: latest
push: ${{ github.ref == 'refs/heads/master' }}
docker_push_tag:
needs: build_and_test
runs-on: ubuntu-latest
if: github.event_name == 'push'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
@ -61,6 +60,4 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: projectmoon/chronicle-dicebot
tags: latest
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}