name: Prepare and Build on: workflow_call: inputs: config_file: description: "Path to the JSON config file" required: true type: string feature_set: description: "Feature Set" required: false type: string use_repo: description: "Use repo for downloading kernel source" required: false type: boolean default: false use_latest_commits: description: "Use branch tip for KernelSU and SUSFS instead of pinned commits" required: false type: boolean default: true jobs: generate-matrix: runs-on: ubuntu-latest outputs: matrix: ${{ steps.final.outputs.matrix }} steps: - name: Checkout Repository uses: actions/checkout@v5 - name: Read Config and Build Final Matrix id: final shell: bash run: | if [ ! -f "${{ inputs.config_file }}" ]; then echo "Error: Config file not found: ${{ inputs.config_file }}" exit 1 fi CONFIG_JSON=$(cat "${{ inputs.config_file }}" | jq -c .) # Build { "include": [ {android_version:..., kernel_version:..., sublevel:..., os_patch_level:..., variant: ...}, ... ] } # Always include Normal, and add any explicit per-item variant from the config. FINAL=$(jq -cn \ --argjson cfg "$CONFIG_JSON" ' ($cfg.version | split("-")) as $version_parts | { include: ( [ $cfg.include[] as $item | { version: $cfg.version, android_version: $version_parts[0], kernel_version: $version_parts[1], sublevel: $item.sublevel, os_patch_level: $item.date, variant: "Normal" } ] + [ $cfg.include[] as $item | select($item.variant != null) | { version: $cfg.version, android_version: $version_parts[0], kernel_version: $version_parts[1], sublevel: $item.sublevel, os_patch_level: $item.date, variant: $item.variant } ] | unique_by([.android_version, .kernel_version, .sublevel, .os_patch_level, .variant]) ) }') echo "matrix=$FINAL" >> "$GITHUB_OUTPUT" build: needs: generate-matrix strategy: fail-fast: false matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} uses: ./.github/workflows/build.yml with: version: ${{ matrix.version }} android_version: ${{ matrix.android_version }} kernel_version: ${{ matrix.kernel_version }} sublevel: ${{ matrix.sublevel }} os_patch_level: ${{ matrix.os_patch_level }} variant: ${{ matrix.variant }} feature_set: ${{ inputs.feature_set }} use_repo: ${{ inputs.use_repo }} use_latest_commits: ${{ inputs.use_latest_commits }} secrets: inherit