Skip to content

Commit dc62138

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 23b29f4 commit dc62138

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
@@ -25,6 +25,9 @@ jobs:
2525
github.event.action != 'labeled' ||
2626
github.event.label.name == 'ci:main')
2727
runs-on: ubuntu-latest
28+
outputs:
29+
x86_64_target: ${{ steps.set-targets.outputs.x86_64_target }}
30+
aarch64_target: ${{ steps.set-targets.outputs.aarch64_target }}
2831
steps:
2932
- run: |
3033
echo "Triggering build ——————————————————————————————————————————————"
@@ -33,26 +36,37 @@ jobs:
3336
echo "Ref : ${{ github.ref }}"
3437
echo "PR : ${{ github.event.pull_request.number }}"
3538
echo "Label : ${{ github.event.label.name }}"
39+
- id: set-targets
40+
run: |
41+
if [[ "${{ github.event_name }}" == "pull_request" ]] && \
42+
! echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' \
43+
| grep -q "ci:main"; then
44+
echo "x86_64_target=x86_64_minimal" >> $GITHUB_OUTPUT
45+
echo "aarch64_target=aarch64_minimal" >> $GITHUB_OUTPUT
46+
else
47+
echo "x86_64_target=x86_64" >> $GITHUB_OUTPUT
48+
echo "aarch64_target=aarch64" >> $GITHUB_OUTPUT
49+
fi
3650
3751
build-x86_64:
3852
needs: check-trigger
3953
uses: ./.github/workflows/build.yml
4054
with:
4155
name: "infix"
42-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
56+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
4357

4458
build-aarch64:
4559
needs: check-trigger
4660
uses: ./.github/workflows/build.yml
4761
with:
4862
name: "infix"
49-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'aarch64_minimal' || 'aarch64' }}
63+
target: ${{ needs.check-trigger.outputs.aarch64_target }}
5064

5165
test-run-x86_64:
52-
needs: build-x86_64
66+
needs: [check-trigger, build-x86_64]
5367
uses: ./.github/workflows/test.yml
5468
with:
55-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
69+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
5670
name: "infix"
5771

5872
test-publish-x86_64:

0 commit comments

Comments
 (0)