prepare.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. jobs:
  34. generate-matrix:
  35. runs-on: ubuntu-latest
  36. outputs:
  37. matrix: ${{ steps.set-matrix.outputs.matrix }}
  38. steps:
  39. - name: Checkout Repository
  40. uses: actions/checkout@v5
  41. - name: Read Config and Generate Matrix
  42. id: set-matrix
  43. run: |
  44. echo "Reading config from ${{ inputs.config_file }}"
  45. if [ ! -f "${{ inputs.config_file }}" ]; then
  46. echo "Error: Config file not found: ${{ inputs.config_file }}"
  47. exit 1
  48. fi
  49. MATRIX_JSON=$(cat "${{ inputs.config_file }}")
  50. if command -v jq &> /dev/null; then
  51. MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c '[.include[].kernel_version]')
  52. else
  53. echo "jq not found, cannot build matrix."
  54. exit 1
  55. fi
  56. echo "Matrix content: $MATRIX_JSON"
  57. echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
  58. build:
  59. needs: generate-matrix
  60. strategy:
  61. fail-fast: false
  62. matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
  63. uses: ./.github/workflows/build.yml
  64. with:
  65. kernel_version: ${{ matrix.kernel_version }}
  66. variant: ${{ matrix.variant }}
  67. ksu_commit: ${{ inputs.ksu_commit }}
  68. anykernel_commit: ${{ inputs.anykernel_commit }}
  69. patches_commit: ${{ inputs.patches_commit }}
  70. susfs_commit: ${{ inputs.susfs_commit }}
  71. feature_set: ${{ inputs.feature_set }}
  72. secrets: inherit