Skip to content

Commit

Permalink
gh workflow: try passing SHOULD_PUBLISH vars as outputs since not ava…
Browse files Browse the repository at this point in the history
…ilable as env
  • Loading branch information
dandelany committed Aug 27, 2024
1 parent c70af30 commit 33b812f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
# set these as outputs to make available later, since `env` context isn't available in `jobs.if`
SHOULD_PUBLISH_IMAGES: ${{ env.SHOULD_PUBLISH_IMAGES }}
SHOULD_PUBLISH_DEPLOYMENT: ${{ env.SHOULD_PUBLISH_DEPLOYMENT }}
steps:
- uses: actions/checkout@v4

Expand All @@ -38,9 +42,9 @@ jobs:
run: ./gradlew --version

containers:
if: ${{ env.SHOULD_PUBLISH_IMAGES }}
runs-on: ubuntu-latest
needs: init
if: ${{ needs.init.outputs.SHOULD_PUBLISH_IMAGES }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -124,9 +128,9 @@ jobs:
labels: ${{ steps.metadata-step.outputs.labels }}

scan:
if: ${{ env.SHOULD_PUBLISH_IMAGES }}
runs-on: ubuntu-latest
needs: containers
if: ${{ needs.init.outputs.SHOULD_PUBLISH_IMAGES }}
strategy:
matrix:
image:
Expand Down Expand Up @@ -160,10 +164,10 @@ jobs:
path: "${{ matrix.image }}-results.html"

publish:
if: ${{ env.SHOULD_PUBLISH_DEPLOYMENT }}
name: gradle publish
runs-on: ubuntu-latest
needs: init
if: ${{ needs.init.outputs.SHOULD_PUBLISH_DEPLOYMENT }}
permissions:
contents: read
packages: write
Expand Down

0 comments on commit 33b812f

Please sign in to comment.