Skip to content

Commit f95b56d

Browse files
authored
Update main.yml (#197)
1 parent dc3b05b commit f95b56d

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,33 @@ jobs:
3636
BUILDS=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs" --paginate \
3737
--jq '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' | \
3838
jq --slurp -c -r)
39-
echo "$BUILDS" | jq .
40-
echo "matrix=${BUILDS}" >> $GITHUB_OUTPUT
39+
# Group the output by platform.
40+
GROUPS=$("$BUILDS" | jq -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})')
41+
echo "${GROUPS}" | jq .
42+
echo "matrix=${GROUPS}" >> $GITHUB_OUTPUT
4143
42-
ghcr-upload:
44+
# We need this process step in here, because we have in excess of 256 jobs.
45+
process:
4346
needs: discover
47+
runs-on: ubuntu-latest # You still need runs-on to define a job, but it can be minimal
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
group: ${{ fromJson(needs.discover.outputs.matrix) }}
52+
name: Process Jobs for ${{ matrix.group.platform }}
53+
outputs:
54+
jobs: ${{ toJson(matrix.group.jobs) }} # Direct output definition
55+
steps:
56+
- name: No-op step (required to have at least one step)
57+
run: echo "No-op" # Minimal step to satisfy step requirement
58+
59+
ghcr-upload:
60+
needs: process
4461
name: Container Upload
4562
strategy:
4663
fail-fast: false
4764
matrix:
48-
job: ${{ fromJson(needs.discover.outputs.matrix) }}
65+
job: ${{ fromJson(needs.process.outputs.matrix) }}
4966
runs-on: ubuntu-latest
5067
permissions:
5168
contents: read

0 commit comments

Comments
 (0)