Skip to content

Commit c0de8e2

Browse files
committed
Lets try this appraoch
1 parent b1efcc5 commit c0de8e2

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

.github/workflows/container-upload.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Container Upload Workflow
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
55
inputs:
66
platform:
77
required: true
@@ -40,10 +40,10 @@ jobs:
4040
registry: ${{ env.REGISTRY }}
4141
username: ${{ github.actor }}
4242
password: ${{ secrets.GITHUB_TOKEN }}
43-
- name: Upload Container for Job ${{ matrix.job }}
43+
- name: Upload Container for Job ${{ matrix.job }}
4444
- name: Compute and upload closure and developer environment to ghcr.io
4545
env:
4646
DEV_SHELL: ${{ matrix.job.config }}
4747
SHELL_NIX_PATH: ${{ matrix.job.build_path }}
4848
NIX_STORE_SECRET_KEY: ${{ secrets.SECRET_KEY }}
49-
run: ./extra/ghcr-upload.sh
49+
run: ./extra/ghcr-upload.sh

.github/workflows/main.yml

+15-28
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Prebuild DevX closures
2-
on:
3-
push:
42

5-
workflow_dispatch:
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
69

710
env:
811
REGISTRY: ghcr.io
@@ -34,45 +37,29 @@ jobs:
3437
# Group the output by platform.
3538
RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/2c66429a549f1122374faf3e1eb097e07a8f0c22/check-runs" --paginate)
3639
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")
3841
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")
4043
jq . <<< "$MATRIX"
4144
echo "creating result matrix."
4245
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
4346
4447
# We need this process step in here, because we have in excess of 256 jobs.
4548
process:
4649
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
4851
strategy:
4952
fail-fast: false
5053
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 }}
5356
steps:
5457
- name: Call Container Upload Workflow
55-
uses: actions/github-script@v6
58+
uses: ./.github/workflows/container-upload.yml
5659
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+
7663
# codespace-upload:
7764
# env:
7865
# IMAGE_NAME: input-output-hk/devx-devcontainer

.github/workflows/x86_64-linux.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Prebuild DevX closures for x86_64-linux
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Run Prebuild Workflow for x86_64-linux
11+
uses: ./.github/workflows/main.yml
12+
with:
13+
platform: x86_64-linux

0 commit comments

Comments
 (0)