prepare.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. name: Prepare and Build
  2. on:
  3. workflow_call:
  4. inputs:
  5. config_file:
  6. description: "Path to the JSON config file"
  7. required: true
  8. type: string
  9. ksu_commit:
  10. description: "KSU Commit"
  11. required: false
  12. type: string
  13. anykernel_commit:
  14. description: "AnyKernel3 Commit"
  15. required: false
  16. type: string
  17. patches_commit:
  18. description: "Kernel Patches Commit"
  19. required: false
  20. type: string
  21. susfs_commit:
  22. description: "SUSFS Commit"
  23. required: false
  24. type: string
  25. feature_set:
  26. description: "Feature Set"
  27. required: false
  28. type: string
  29. variant:
  30. description: "Build Variant (All, Normal, Bypass, Wild)"
  31. required: false
  32. type: string
  33. use_repo:
  34. description: "Use repo for downloading kernel source"
  35. required: false
  36. type: boolean
  37. default: false
  38. jobs:
  39. generate-matrix:
  40. runs-on: ubuntu-latest
  41. outputs:
  42. matrix: ${{ steps.final.outputs.matrix }}
  43. steps:
  44. - name: Checkout Repository
  45. uses: actions/checkout@v5
  46. - name: Read Config and Build Final Matrix
  47. id: final
  48. shell: bash
  49. run: |
  50. if [ ! -f "${{ inputs.config_file }}" ]; then
  51. echo "Error: Config file not found: ${{ inputs.config_file }}"
  52. exit 1
  53. fi
  54. CONFIG_JSON=$(cat "${{ inputs.config_file }}" | jq -c .)
  55. # Build the variant list as a JSON array
  56. if [ "${{ inputs.variant }}" = "All" ] || [ -z "${{ inputs.variant }}" ]; then
  57. VARIANTS='["Normal","Bypass","Wild"]'
  58. else
  59. VARIANTS=$(jq -cn --arg v "${{ inputs.variant }}" '[$v]')
  60. fi
  61. # Build { "include": [ {kernel_version:..., variant: ...}, ... ] }
  62. FINAL=$(jq -cn \
  63. --argjson cfg "$CONFIG_JSON" \
  64. --argjson variants "$VARIANTS" '
  65. {
  66. include: [
  67. $cfg.include[] as $item
  68. | $variants[] as $variant
  69. | $item + {variant: $variant}
  70. ]
  71. }')
  72. echo "matrix=$FINAL" >> "$GITHUB_OUTPUT"
  73. build:
  74. needs: generate-matrix
  75. strategy:
  76. fail-fast: false
  77. matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
  78. uses: ./.github/workflows/build.yml
  79. with:
  80. kernel_version: ${{ matrix.kernel_version }}
  81. variant: ${{ matrix.variant }}
  82. ksu_commit: ${{ inputs.ksu_commit }}
  83. anykernel_commit: ${{ inputs.anykernel_commit }}
  84. patches_commit: ${{ inputs.patches_commit }}
  85. susfs_commit: ${{ inputs.susfs_commit }}
  86. feature_set: ${{ inputs.feature_set }}
  87. use_repo: ${{ inputs.use_repo }}
  88. secrets: inherit