| 
1 | 1 | name: Prebuild DevX closures  | 
2 |  | -on:  | 
3 |  | -  push:  | 
4 |  | -    branches:  | 
5 |  | -      - main  | 
6 | 2 | 
 
  | 
7 |  | -  workflow_dispatch:  | 
 | 3 | +on:  | 
 | 4 | +  workflow_call:  | 
 | 5 | +    inputs:  | 
 | 6 | +      platform:  | 
 | 7 | +        required: true  | 
 | 8 | +        type: string  | 
8 | 9 | 
 
  | 
9 | 10 | env:  | 
10 | 11 |   REGISTRY: ghcr.io  | 
@@ -36,49 +37,28 @@ jobs:  | 
36 | 37 |         # Group the output by platform.  | 
37 | 38 |         RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs" --paginate)  | 
38 | 39 |         echo "checks..."  | 
39 |  | -        FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) |  { "config": .name, "build_path": .output.text }' <<< "$RUNS")  | 
40 |  | -        echo "filtered..."  | 
41 |  | -        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 |  | -        echo "groups..."  | 
43 |  | -        if jq -e . <<< "$MATRIX" > /dev/null 2>&1; then  # JSON validation  | 
44 |  | -          echo "Valid JSON"  | 
45 |  | -        else  | 
46 |  | -          echo "Invalid JSON: $MATRIX"  | 
47 |  | -          exit 1 # or handle the error appropriately  | 
48 |  | -        fi  | 
 | 40 | +        FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | select(.name | startswith("${{ inputs.platform }}")) | { "config": .name, "build_path": .output.text, "short_name": .name | sub("${{ inputs.platform }}\\.";"") }' <<< "$RUNS")  | 
 | 41 | +        jq . <<< "$FILTERED"  | 
 | 42 | +        MATRIX=$(jq --slurp -c -r '.' <<< "$FILTERED")  | 
 | 43 | +        jq . <<< "$MATRIX"  | 
49 | 44 |         echo "creating result matrix."  | 
50 | 45 |         echo "matrix=$MATRIX" >> $GITHUB_OUTPUT  | 
51 | 46 | 
  | 
52 | 47 |   # We need this process step in here, because we have in excess of 256 jobs.  | 
53 | 48 |   process:  | 
54 | 49 |     needs: discover  | 
55 |  | -    runs-on: ubuntu-latest # You still need runs-on to define a job, but it can be minimal  | 
56 |  | -    strategy:  | 
57 |  | -      fail-fast: false  | 
58 |  | -      matrix:  | 
59 |  | -        group: ${{ fromJson(needs.discover.outputs.matrix) }}  | 
60 |  | -    name: Process Jobs for ${{ matrix.group.platform }}  | 
61 |  | -    outputs:  | 
62 |  | -      jobs: ${{ toJson(matrix.group.jobs) }} # Direct output definition  | 
63 |  | -    steps:  | 
64 |  | -      - name: No-op step (required to have at least one step)  | 
65 |  | -        run: echo "No-op" # Minimal step to satisfy step requirement  | 
66 |  | - | 
67 |  | -  ghcr-upload:  | 
68 |  | -    needs: process  | 
69 |  | -    name: Container Upload  | 
 | 50 | +    runs-on: ubuntu-latest  | 
70 | 51 |     strategy:  | 
71 | 52 |       fail-fast: false  | 
72 | 53 |       matrix:  | 
73 |  | -        job: ${{ fromJson(needs.process.outputs.matrix) }}  | 
74 |  | -    runs-on: ubuntu-latest  | 
 | 54 | +        job: ${{ fromJson(needs.discover.outputs.matrix) }}  | 
 | 55 | +    name: GHCR Upload for ${{ matrix.job.short_name }}  | 
75 | 56 |     permissions:  | 
76 | 57 |       contents: read  | 
77 | 58 |       packages: write  | 
78 | 59 |     steps:  | 
79 | 60 |       - name: Free Disk Space (Ubuntu)  | 
80 | 61 |         uses: jlumbroso/free-disk-space@main  | 
81 |  | - | 
82 | 62 |       - name: Install Nix with good defaults  | 
83 | 63 |         uses: cachix/install-nix-action@v20  | 
84 | 64 |         with:  | 
 | 
101 | 81 |           NIX_STORE_SECRET_KEY: ${{ secrets.SECRET_KEY }}  | 
102 | 82 |         run: ./extra/ghcr-upload.sh  | 
103 | 83 | 
 
  | 
 | 84 | + | 
 | 85 | + | 
104 | 86 |   # codespace-upload:  | 
105 | 87 |   #   env:  | 
106 | 88 |   #     IMAGE_NAME: input-output-hk/devx-devcontainer  | 
 | 
0 commit comments