Skip to content

Commit

Permalink
GHA: only try to publish docker image if secrets are set (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Feb 26, 2024
1 parent 7a06016 commit b355ab7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/deploy_protected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@ on:
workflow_dispatch:

jobs:
check-secret:
runs-on: ubuntu-latest
outputs:
secrets-defined: ${{ steps.secret-check.outputs.defined }}
steps:
- name: Check for Secret availability
id: secret-check
shell: bash
run: |
if [ "${{ secrets.DOCKER_USERNAME }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
dockerhub:
name: Deploy Dockerhub
if: github.event.pull_request.head.repo.fork == false
needs: [check-secret]
if: needs.check-secret.outputs.secrets-defined == 'true'
runs-on: ubuntu-22.04

strategy:
Expand Down

0 comments on commit b355ab7

Please sign in to comment.