run release build only if MY_TOKEN secret is set and not empty

This commit is contained in:
Simon Schön 2022-07-23 16:02:38 +02:00
parent c1401cf6db
commit f48d5bfedf
No known key found for this signature in database
GPG Key ID: FD1F8B45F65D5B10

View File

@ -6,9 +6,22 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
check-token:
runs-on: ubuntu-latest
outputs:
token: ${{ steps.token.outputs.defined }}
steps:
- id: token
env:
MY_TOKEN: ${{ secrets.MY_TOKEN }}
if: "${{ env.MY_TOKEN != '' }}"
run: echo "::set-output name=defined::true"
build:
name: Release
runs-on: ubuntu-latest
needs: [check-token]
if: needs.check-token.outputs.token == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3