| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- 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
- ksu_branch:
- description: "KernelSU branch or commit (empty = latest dev)"
- required: false
- type: string
- default: ""
- susfs_commit:
- description: "SUSFS commit hash (empty = latest on auto-derived branch)"
- required: false
- type: string
- default: ""
- root_flavor:
- description: "Mutually exclusive root implementation (kernelsu, next, or resukisu)"
- required: false
- type: string
- default: ""
- root_commit:
- description: "Exact root implementation commit"
- required: false
- type: string
- default: ""
- nomount_commit:
- description: "Exact NoMount commit"
- required: false
- type: string
- default: ""
- kernel_patches_commit:
- description: "Exact kernel_patches commit (resolved automatically)"
- required: false
- type: string
- default: ""
- anykernel3_commit:
- description: "Exact AnyKernel3 commit (resolved automatically)"
- required: false
- type: string
- default: ""
- droidspaces_commit:
- description: "Exact Droidspaces-OSS commit (resolved automatically)"
- required: false
- type: string
- default: ""
- brand_name:
- description: "Kernel branding text appended to the version string"
- required: false
- type: string
- default: Wild
- bypass:
- description: "Apply the kernel version-check bypass hack (disabled by default)"
- required: false
- type: boolean
- default: false
- os_patch_level:
- description: "Optional filter: patch date (YYYY-MM), kernel sublevel, lts (LTS branch), or all"
- required: false
- type: string
- default: ""
- variant:
- description: "Artifact variant label"
- required: false
- type: string
- default: ""
- jobs:
- generate-matrix:
- runs-on: ubuntu-latest
- outputs:
- matrix: ${{ steps.final.outputs.matrix }}
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v7
- - 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: ...}, ... ] }.
- # An explicit patch-level filter keeps manual validation dispatches bounded.
- FINAL=$(jq -cn \
- --argjson cfg "$CONFIG_JSON" \
- --arg requested_variant "${{ inputs.variant }}" '
- ($cfg.version | split("-")) as $version_parts
- | ($cfg.include) as $targets
- | {
- include: (
- [
- $targets[] as $item
- | {
- version: $cfg.version,
- android_version: $version_parts[0],
- kernel_version: $version_parts[1],
- sublevel: $item.sublevel,
- os_patch_level: $item.date,
- variant: (if $requested_variant == "" then "Normal" else $requested_variant end)
- }
- ]
- + (if $requested_variant == "" then [
- $targets[] 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
- }
- ] else [] end)
- | unique_by([.android_version, .kernel_version, .sublevel, .os_patch_level, .variant])
- )
- }')
- SELECTED_PATCH_LEVEL="${{ inputs.os_patch_level }}"
- if [ "$(printf '%s' "$SELECTED_PATCH_LEVEL" | tr '[:upper:]' '[:lower:]')" = "all" ]; then
- SELECTED_PATCH_LEVEL=""
- fi
- if [ -n "$SELECTED_PATCH_LEVEL" ]; then
- FULL_FINAL="$FINAL"
- FINAL=$(jq -c --arg patch_level "$SELECTED_PATCH_LEVEL" '
- {include: [.include[] | select(.os_patch_level == $patch_level)]}
- ' <<< "$FINAL")
- # No date matched -- try interpreting the value as a kernel sublevel
- if [ "$(jq '.include | length' <<< "$FINAL")" -eq 0 ]; then
- FINAL=$(jq -c --arg sublevel "$SELECTED_PATCH_LEVEL" '
- {include: [.include[] | select(.sublevel == $sublevel)]}
- ' <<< "$FULL_FINAL")
- fi
- fi
- if [ "$(jq '.include | length' <<< "$FINAL")" -eq 0 ]; then
- echo "Error: no build targets match patch level '${SELECTED_PATCH_LEVEL}'." >&2
- exit 1
- fi
- 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 }}
- ksu_branch: ${{ inputs.ksu_branch }}
- susfs_commit: ${{ inputs.susfs_commit }}
- root_flavor: ${{ inputs.root_flavor }}
- root_commit: ${{ inputs.root_commit }}
- nomount_commit: ${{ inputs.nomount_commit }}
- kernel_patches_commit: ${{ inputs.kernel_patches_commit }}
- anykernel3_commit: ${{ inputs.anykernel3_commit }}
- droidspaces_commit: ${{ inputs.droidspaces_commit }}
- brand_name: ${{ inputs.brand_name }}
- bypass: ${{ inputs.bypass }}
- secrets: inherit
|