main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. name: Build Kernels
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. release_type:
  9. description: "Release Type"
  10. type: choice
  11. options: [ Actions, Pre-Release, Release ]
  12. default: Actions
  13. ksu_commit:
  14. description: "KSU Commit (optional)"
  15. type: string
  16. default: ""
  17. required: false
  18. kernel_build_version:
  19. description: "Kernel Version to Build"
  20. type: choice
  21. options:
  22. - all
  23. - a12-5-10
  24. - a13-5-10
  25. - a13-5-15
  26. - a14-5-15
  27. - a14-6-1
  28. - a15-6-6
  29. - a16-6-12
  30. - lts
  31. - custom
  32. - testing
  33. - bypass
  34. default: custom
  35. feature_set:
  36. description: "Feature Set"
  37. type: choice
  38. options:
  39. - WKSU+SUSFS+BBG
  40. - WKSU+BBG
  41. - WKSU
  42. - BBG
  43. - None
  44. default: WKSU+SUSFS+BBG
  45. push:
  46. branches:
  47. - main
  48. jobs:
  49. download-dependencies:
  50. uses: ./.github/workflows/dependencies.yml
  51. build-a12-5-10:
  52. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a12-5-10' }}
  53. needs: download-dependencies
  54. uses: ./.github/workflows/prepare.yml
  55. with:
  56. config_file: .github/kernel-config/a12-5.10.json
  57. ksu_commit: ${{ inputs.ksu_commit || '' }}
  58. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  59. secrets: inherit
  60. build-a13-5-10:
  61. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-10' }}
  62. needs: download-dependencies
  63. uses: ./.github/workflows/prepare.yml
  64. with:
  65. config_file: .github/kernel-config/a13-5.10.json
  66. ksu_commit: ${{ inputs.ksu_commit || '' }}
  67. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  68. secrets: inherit
  69. build-a13-5-15:
  70. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-15' }}
  71. needs: download-dependencies
  72. uses: ./.github/workflows/prepare.yml
  73. with:
  74. config_file: .github/kernel-config/a13-5.15.json
  75. ksu_commit: ${{ inputs.ksu_commit || '' }}
  76. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  77. secrets: inherit
  78. build-a14-5-15:
  79. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-5-15' }}
  80. needs: download-dependencies
  81. uses: ./.github/workflows/prepare.yml
  82. with:
  83. config_file: .github/kernel-config/a14-5.15.json
  84. ksu_commit: ${{ inputs.ksu_commit || '' }}
  85. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  86. secrets: inherit
  87. build-a14-6-1:
  88. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-6-1' }}
  89. needs: download-dependencies
  90. uses: ./.github/workflows/prepare.yml
  91. with:
  92. config_file: .github/kernel-config/a14-6.1.json
  93. ksu_commit: ${{ inputs.ksu_commit || '' }}
  94. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  95. secrets: inherit
  96. build-a15-6-6:
  97. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a15-6-6' }}
  98. needs: download-dependencies
  99. uses: ./.github/workflows/prepare.yml
  100. with:
  101. config_file: .github/kernel-config/a15-6.6.json
  102. ksu_commit: ${{ inputs.ksu_commit || '' }}
  103. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  104. secrets: inherit
  105. build-a16-6-12:
  106. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a16-6-12' }}
  107. needs: download-dependencies
  108. uses: ./.github/workflows/prepare.yml
  109. with:
  110. config_file: .github/kernel-config/a16-6.12.json
  111. ksu_commit: ${{ inputs.ksu_commit || '' }}
  112. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  113. secrets: inherit
  114. build-lts:
  115. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'lts' || github.event_name == 'push' }}
  116. needs: download-dependencies
  117. uses: ./.github/workflows/prepare.yml
  118. with:
  119. config_file: .github/kernel-config/lts.json
  120. ksu_commit: ${{ inputs.ksu_commit || '' }}
  121. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  122. secrets: inherit
  123. build-custom:
  124. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'custom' }}
  125. needs: download-dependencies
  126. uses: ./.github/workflows/prepare.yml
  127. with:
  128. config_file: .github/kernel-config/custom.json
  129. ksu_commit: ${{ inputs.ksu_commit || '' }}
  130. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  131. secrets: inherit
  132. build-testing:
  133. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'testing' || github.event_name == 'push' }}
  134. needs: download-dependencies
  135. uses: ./.github/workflows/prepare.yml
  136. with:
  137. config_file: .github/kernel-config/testing.json
  138. ksu_commit: ${{ inputs.ksu_commit || '' }}
  139. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  140. secrets: inherit
  141. build-bypass:
  142. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'bypass' }}
  143. needs: download-dependencies
  144. uses: ./.github/workflows/prepare.yml
  145. with:
  146. config_file: .github/kernel-config/bypass.json
  147. ksu_commit: ${{ inputs.ksu_commit || '' }}
  148. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  149. secrets: inherit
  150. rej:
  151. if: always()
  152. runs-on: ubuntu-latest
  153. permissions:
  154. actions: read
  155. contents: read
  156. needs:
  157. - build-a12-5-10
  158. - build-a13-5-10
  159. - build-a13-5-15
  160. - build-a14-5-15
  161. - build-a14-6-1
  162. - build-a15-6-6
  163. - build-a16-6-12
  164. - build-custom
  165. - build-lts
  166. - build-testing
  167. - build-bypass
  168. steps:
  169. - name: Download Misc Artifacts
  170. uses: actions/download-artifact@v4
  171. with:
  172. path: ./downloaded-artifacts
  173. pattern: '*-Rejects'
  174. merge-multiple: false
  175. - name: Process Reject Artifacts
  176. run: |
  177. mkdir -p aio-rejects
  178. # Iterate over Rejects artifacts in downloaded-artifacts
  179. for dir in ./downloaded-artifacts/*-Rejects; do
  180. # Ensure it is a directory
  181. [ -d "$dir" ] || continue
  182. dirname=$(basename "$dir")
  183. # Process each reject artifact
  184. # Get original name (remove -Rejects suffix)
  185. original_name=${dirname%-Rejects}
  186. mkdir -p "aio-rejects/$original_name"
  187. # Check for patch-rejects folder (legacy structure) or direct contents
  188. if [ -d "$dir/patch-rejects" ]; then
  189. # Legacy structure
  190. cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
  191. else
  192. # Current structure
  193. cp -r "$dir/." "aio-rejects/$original_name/"
  194. fi
  195. done
  196. # Zip and upload if we found anything
  197. if [ "$(ls -A aio-rejects)" ]; then
  198. # Create a single zip of all rejects
  199. cd aio-rejects
  200. zip -r -q -9 ../AIO-REJ.zip .
  201. cd ..
  202. else
  203. echo "No rejects found to upload."
  204. fi
  205. - name: Upload AIO-REJ Artifact
  206. uses: actions/upload-artifact@v4
  207. with:
  208. name: AIO-REJ
  209. path: AIO-REJ.zip
  210. if-no-files-found: ignore
  211. release:
  212. runs-on: ubuntu-latest
  213. if: ${{ github.event_name == 'workflow_dispatch' && inputs.release_type != 'Actions' }}
  214. permissions:
  215. contents: write
  216. needs:
  217. - build-a12-5-10
  218. - build-a13-5-10
  219. - build-a13-5-15
  220. - build-a14-5-15
  221. - build-a14-6-1
  222. - build-a15-6-6
  223. - build-a16-6-12
  224. - build-lts
  225. - build-custom
  226. - build-testing
  227. - build-bypass
  228. env:
  229. GH_TOKEN: ${{ github.token }}
  230. RELEASE_NAME: "GKI Kernels With WKSU & SUSFS v2.0.0"
  231. RELEASE_BODY: ""
  232. outputs:
  233. new_tag: ${{ steps.tag.outputs.new_tag }}
  234. steps:
  235. - name: Validate Selected Builds
  236. run: |
  237. set -euo pipefail
  238. failed=0
  239. current_type="${{ inputs.kernel_build_version }}"
  240. check_selected() {
  241. local target="$1"
  242. local job_name="$2"
  243. local result="$3"
  244. if [[ "$current_type" == "all" || "$current_type" == "$target" ]]; then
  245. if [[ "$result" != "success" ]]; then
  246. echo "Required job $job_name did not succeed (result: $result)"
  247. failed=1
  248. fi
  249. fi
  250. }
  251. check_selected "a12-5-10" "build-a12-5-10" "${{ needs.build-a12-5-10.result }}"
  252. check_selected "a13-5-10" "build-a13-5-10" "${{ needs.build-a13-5-10.result }}"
  253. check_selected "a13-5-15" "build-a13-5-15" "${{ needs.build-a13-5-15.result }}"
  254. check_selected "a14-5-15" "build-a14-5-15" "${{ needs.build-a14-5-15.result }}"
  255. check_selected "a14-6-1" "build-a14-6-1" "${{ needs.build-a14-6-1.result }}"
  256. check_selected "a15-6-6" "build-a15-6-6" "${{ needs.build-a15-6-6.result }}"
  257. check_selected "a16-6-12" "build-a16-6-12" "${{ needs.build-a16-6-12.result }}"
  258. check_selected "custom" "build-custom" "${{ needs.build-custom.result }}"
  259. check_selected "lts" "build-lts" "${{ needs.build-lts.result }}"
  260. check_selected "testing" "build-testing" "${{ needs.build-testing.result }}"
  261. if [[ "$failed" -ne 0 ]]; then
  262. exit 1
  263. fi
  264. - name: Free Disk Space
  265. if: true
  266. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  267. with:
  268. remove_android: true
  269. remove_dotnet: true
  270. remove_haskell: true
  271. remove_tool_cache: true
  272. remove_swap: true
  273. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  274. remove_packages_one_command: true
  275. remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
  276. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  277. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  278. testing: false
  279. - name: Checkout code
  280. uses: actions/checkout@v4
  281. - name: Generate New Tag
  282. id: tag
  283. if: inputs.release_type != 'Actions'
  284. run: |
  285. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "v0.0.0")
  286. if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then
  287. LATEST_TAG="v0.0.0"
  288. fi
  289. if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
  290. VERSION="${BASH_REMATCH[1]}"
  291. REV="${BASH_REMATCH[2]}"
  292. NEW_REV=$((REV + 1))
  293. NEW_TAG="${VERSION}-r${NEW_REV}"
  294. else
  295. NEW_TAG="${LATEST_TAG}-r1"
  296. fi
  297. echo "Latest tag: $LATEST_TAG"
  298. echo "New tag: $NEW_TAG"
  299. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  300. echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
  301. - name: Set release body
  302. run: |
  303. cat << 'EOF' > release_body.md
  304. **Automated Release**
  305. This release was automatically generated by GitHub Actions.
  306. **Builds:**
  307. EOF
  308. # Add details about included builds
  309. if [[ "${{ inputs.kernel_build_version }}" == "all" ]]; then
  310. echo "- All Kernel Versions" >> release_body.md
  311. else
  312. echo "- ${{ inputs.kernel_build_version }}" >> release_body.md
  313. fi
  314. - name: Create Release
  315. uses: softprops/action-gh-release@v1
  316. with:
  317. tag_name: ${{ steps.tag.outputs.new_tag }}
  318. name: ${{ steps.tag.outputs.new_tag }}
  319. body_path: release_body.md
  320. draft: false
  321. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  322. files: |
  323. AnyKernel3/**/*.zip
  324. AIO-REJ.zip