|
1 | 1 | name: Prebuild DevX closures
|
2 |
| -on: |
3 |
| - push: |
4 | 2 |
|
5 |
| - workflow_dispatch: |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + platform: |
| 7 | + required: true |
| 8 | + type: string |
6 | 9 |
|
7 | 10 | env:
|
8 | 11 | REGISTRY: ghcr.io
|
@@ -34,45 +37,29 @@ jobs:
|
34 | 37 | # Group the output by platform.
|
35 | 38 | RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/2c66429a549f1122374faf3e1eb097e07a8f0c22/check-runs" --paginate)
|
36 | 39 | echo "checks..."
|
37 |
| - FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' <<< "$RUNS") |
| 40 | + FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | select(.name | startswith("${{ inputs.platform }}")) | { "config": .name, "build_path": .output.text }' <<< "$RUNS") |
38 | 41 | jq . <<< "$FILTERED"
|
39 |
| - MATRIX=$(jq --slurp -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})' <<< "$FILTERED") |
| 42 | + MATRIX=$(jq --slurp -c -r '.' <<< "$FILTERED") |
40 | 43 | jq . <<< "$MATRIX"
|
41 | 44 | echo "creating result matrix."
|
42 | 45 | echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
|
43 | 46 |
|
44 | 47 | # We need this process step in here, because we have in excess of 256 jobs.
|
45 | 48 | process:
|
46 | 49 | needs: discover
|
47 |
| - runs-on: ubuntu-latest # You still need runs-on to define a job, but it can be minimal |
| 50 | + runs-on: ubuntu-latest |
48 | 51 | strategy:
|
49 | 52 | fail-fast: false
|
50 | 53 | matrix:
|
51 |
| - group: ${{ fromJson(needs.discover.outputs.matrix) }} |
52 |
| - name: Process Jobs for ${{ matrix.group.platform }} |
| 54 | + jobs: ${{ fromJson(needs.discover.outputs.matrix) }} |
| 55 | + name: Process Jobs for ${{ inputs.platform }} |
53 | 56 | steps:
|
54 | 57 | - name: Call Container Upload Workflow
|
55 |
| - uses: actions/github-script@v6 |
| 58 | + uses: ./.github/workflows/container-upload.yml |
56 | 59 | with:
|
57 |
| - script: | |
58 |
| - const matrix = JSON.parse(` |
59 |
| - ${{ toJson(matrix) }} |
60 |
| - `); |
61 |
| - const platform = matrix.group.platform; |
62 |
| - const jobs = matrix.group.jobs; |
63 |
| - console.log(`Calling container-upload workflow for platform: ${platform} with ${jobs.length} jobs`); |
64 |
| - |
65 |
| - await github.rest.actions.createWorkflowDispatch({ |
66 |
| - owner: context.repo.owner, |
67 |
| - repo: context.repo.repo, |
68 |
| - workflow_id: 'container-upload.yml', // Filename of the reusable workflow |
69 |
| - ref: context.ref, // Or specify a branch/tag |
70 |
| - inputs: { |
71 |
| - platform: platform, |
72 |
| - jobs: JSON.stringify(jobs) // Pass jobs as JSON string |
73 |
| - } |
74 |
| - }); |
75 |
| - |
| 60 | + platform: ${{ inputs.platform }} |
| 61 | + jobs: ${{ matrix.jobs }} |
| 62 | + |
76 | 63 | # codespace-upload:
|
77 | 64 | # env:
|
78 | 65 | # IMAGE_NAME: input-output-hk/devx-devcontainer
|
|
0 commit comments