prepare.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. # Read the file content
  50. MATRIX_JSON=$(cat "${{ inputs.config_file }}")
  51. # Compact the JSON to a single line to avoid issues
  52. # If jq is not available, we might need another way, but ubuntu-latest usually has it.
  53. if command -v jq &> /dev/null; then
  54. MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c .)
  55. else
  56. # Fallback for simple minification if jq missing (unlikely on runner)
  57. MATRIX_JSON=$(echo "$MATRIX_JSON" | tr -d '\n' | tr -d ' ')
  58. fi
  59. echo "Matrix content: $MATRIX_JSON"
  60. echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
  61. build:
  62. needs: generate-matrix
  63. strategy:
  64. fail-fast: false
  65. matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
  66. uses: ./.github/workflows/build.yml
  67. with:
  68. kernel_version: ${{ matrix.kernel_version }}
  69. variant: ${{ matrix.variant }}
  70. ksu_commit: ${{ inputs.ksu_commit }}
  71. anykernel_commit: ${{ inputs.anykernel_commit }}
  72. patches_commit: ${{ inputs.patches_commit }}
  73. susfs_commit: ${{ inputs.susfs_commit }}
  74. feature_set: ${{ inputs.feature_set }}
  75. secrets: inherit