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

Simon Schön committed Jul 23, 2022 at 16:02 UTC f48d5bfedf661d8ca2de5762d98875206a3f7fca
1 file changed +13
.github/workflows/docker.yml
+13
@@ -6,9 +6,22 @@ env:
6 REGISTRY: ghcr.io
7 IMAGE_NAME: ${{ github.repository }}
8 jobs:
9 + check-token:
10 + runs-on: ubuntu-latest
11 + outputs:
12 + token: ${{ steps.token.outputs.defined }}
13 + steps:
14 + - id: token
15 + env:
16 + MY_TOKEN: ${{ secrets.MY_TOKEN }}
17 + if: "${{ env.MY_TOKEN != '' }}"
18 + run: echo "::set-output name=defined::true"
19 +
20 build:
21 name: Release
22 runs-on: ubuntu-latest
23 + needs: [check-token]
24 + if: needs.check-token.outputs.token == 'true'
25 steps:
26 - name: Checkout
27 uses: actions/checkout@v3