Skip to content

Commit

Permalink
[gha] testing inputs.prerelease being false requires comparing string…
Browse files Browse the repository at this point in the history
…s formats

As null is considered false. So null == false is true.
  • Loading branch information
cderv committed Jun 6, 2024
1 parent e94c5d5 commit 46a2ee0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,23 @@ jobs:
uses: quarto-dev/quarto-actions/render@v2

- name: Publish release website
# Only do this step if the branch is main or workflow is called for release deploy (meaning inputs context is defined)
if: ${{ (inputs.prerelease != null && inputs.prerelease == false) || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
# Only do this step if
# - workflow is called for release deploy, with inputs.prerelease being false. It should not trigger if inputs.prerelease is null.
# and in GHA null == false is true. That is why we convert to string and compare.
# - workflow is triggered by push event on main branch
if: ${{ format('{0}', inputs.prerelease) == 'false' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
render: false

- name: Deploy Prerelease website to Netlify
# Only do this step if the branch is prerelease or workflow is called for prerelease deploy
if: ${{ (inputs.prerelease != null && inputs.prerelease == true) || (github.event_name == 'push' && github.ref == 'refs/heads/prerelease') }}
# Only do this step if
# - workflow is called for release deploy with inputs.prerelease being true. It should not trigger if inputs.prerelease is null.
# Though as in GHA null means false, no need to cast to string
# - workflow is triggered by push event on main branch
if: ${{ inputs.prerelease || (github.event_name == 'push' && github.ref == 'refs/heads/prerelease') }}
id: netlify-deploy
uses: nwtgck/actions-netlify@v3
env:
Expand Down

0 comments on commit 46a2ee0

Please sign in to comment.