Add conditions to docker publish
This commit is contained in:
1 file changed
+11
@@ -7,10 +7,21 @@ jobs:
|
||||
name: Build Docker image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check token is set
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
unset HAS_SECRET
|
||||
if [-n $SECRET]; then HAS_SECRET='true' ; fi
|
||||
echo ::set-output name=HAS_SECRET_TOKEN::${HAS_SECRET}
|
||||
env:
|
||||
SECRET: "${{ secrets.DOCKER_TOKEN }}"
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
if: ${{ steps.vars.outputs.HAS_SECRET }}
|
||||
- name: Push to Docker Hub
|
||||
uses: docker/build-push-action@v1
|
||||
if: ${{ steps.vars.outputs.HAS_SECRET }}
|
||||
with:
|
||||
username: thirtythreeforty
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
Reference in new issue
Block a user