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:
parent
ae6922dd6c
commit
16a9aeebcd
|
@ -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/') }}
|
||||
|
|
Loading…
Reference in New Issue