Skip to content

Commit 494623f

Browse files
committed
.github: simplify a bit now that we have a check-trigger
With all jobs now depending on check-trigger we can do the evaluations there and set some variables that can be reused later. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 6198863 commit 494623f

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/trigger.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
github.event.action != 'labeled' ||
2222
github.event.label.name == 'ci:main')
2323
runs-on: ubuntu-latest
24+
outputs:
25+
x86_64_target: ${{ steps.set-targets.outputs.x86_64_target }}
26+
aarch64_target: ${{ steps.set-targets.outputs.aarch64_target }}
2427
steps:
2528
- run: |
2629
echo "Triggering build ——————————————————————————————————————————————"
@@ -29,26 +32,37 @@ jobs:
2932
echo "Ref : ${{ github.ref }}"
3033
echo "PR : ${{ github.event.pull_request.number }}"
3134
echo "Label : ${{ github.event.label.name }}"
35+
- id: set-targets
36+
run: |
37+
if [[ "${{ github.event_name }}" == "pull_request" ]] && \
38+
! echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' \
39+
| grep -q "ci:main"; then
40+
echo "x86_64_target=x86_64_minimal" >> $GITHUB_OUTPUT
41+
echo "aarch64_target=aarch64_minimal" >> $GITHUB_OUTPUT
42+
else
43+
echo "x86_64_target=x86_64" >> $GITHUB_OUTPUT
44+
echo "aarch64_target=aarch64" >> $GITHUB_OUTPUT
45+
fi
3246
3347
build-x86_64:
3448
needs: check-trigger
3549
uses: ./.github/workflows/build.yml
3650
with:
3751
name: "infix"
38-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
52+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
3953

4054
build-aarch64:
4155
needs: check-trigger
4256
uses: ./.github/workflows/build.yml
4357
with:
4458
name: "infix"
45-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'aarch64_minimal' || 'aarch64' }}
59+
target: ${{ needs.check-trigger.outputs.aarch64_target }}
4660

4761
test-run-x86_64:
48-
needs: build-x86_64
62+
needs: [check-trigger, build-x86_64]
4963
uses: ./.github/workflows/test.yml
5064
with:
51-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
65+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
5266
name: "infix"
5367

5468
test-publish-x86_64:

0 commit comments

Comments
 (0)