Skip to content

Commit b7c5a81

Browse files
committed
.github/workflows: ensure that create_release runs if we skip tests
Add logic to ensure that `create_release` is run if we are intentionally skipping tests. Updates #47 Signed-off-by: Mario Minardi <[email protected]>
1 parent 8c8c530 commit b7c5a81

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/workflows/build.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ jobs:
8181

8282
create_release:
8383
runs-on: ubuntu-24.04
84-
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
84+
# By default, the "if" check here is skipped if one of the jobs in the "needs" block
85+
# has been skipped. Adding `always()` ensures that we perform the check even if one
86+
# of the jobs is skipped. We must check that the result of `build_release` is
87+
# "success" and that `test` is one of "success" or "skipped" as a result to ensure
88+
# we are only creating a release when the `test` job has suceeded or been skipped.
89+
if: always() && contains(needs.build_release.result, 'success') && (contains(needs.test.result, 'success') || contains(needs.test.result, 'skipped')) && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
8590
needs: [test, build_release]
8691
outputs:
8792
url: ${{ steps.create_release.outputs.upload_url }}

0 commit comments

Comments
 (0)