main.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. kernel_build_version:
  14. description: "Kernel Version to Build"
  15. type: choice
  16. options:
  17. - all
  18. - a12-5-10
  19. - a13-5-10
  20. - a13-5-15
  21. - a14-5-15
  22. - a14-6-1
  23. - a15-6-6
  24. - a16-6-12
  25. - lts
  26. - custom
  27. - testing
  28. - bypass
  29. default: custom
  30. feature_set:
  31. description: "Feature Set"
  32. type: choice
  33. options:
  34. - WKSU+SUSFS+BBG
  35. - WKSU+BBG
  36. - WKSU
  37. - BBG
  38. - None
  39. default: WKSU+SUSFS+BBG
  40. ksu_commit:
  41. description: "KSU Commit (optional)"
  42. type: string
  43. default: ""
  44. required: false
  45. push:
  46. branches:
  47. - main
  48. jobs:
  49. fetch-commits:
  50. runs-on: ubuntu-latest
  51. outputs:
  52. ksu_commit: ${{ steps.fetch.outputs.ksu_commit }}
  53. anykernel_commit: ${{ steps.fetch.outputs.anykernel_commit }}
  54. patches_commit: ${{ steps.fetch.outputs.patches_commit }}
  55. susfs_commit: ${{ steps.fetch.outputs.susfs_commit }}
  56. steps:
  57. - name: Checkout Repository
  58. uses: actions/checkout@v4
  59. - name: Fetch Commits
  60. id: fetch
  61. uses: ./.github/actions/fetch-commits
  62. with:
  63. ksu_commit: ${{ inputs.ksu_commit }}
  64. build-a12-5-10:
  65. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a12-5-10' }}
  66. needs: fetch-commits
  67. uses: ./.github/workflows/prepare.yml
  68. with:
  69. config_file: .github/kernel-config/a12-5.10.json
  70. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  71. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  72. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  73. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  74. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  75. secrets: inherit
  76. build-a13-5-10:
  77. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-10' }}
  78. needs: fetch-commits
  79. uses: ./.github/workflows/prepare.yml
  80. with:
  81. config_file: .github/kernel-config/a13-5.10.json
  82. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  83. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  84. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  85. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  86. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  87. secrets: inherit
  88. build-a13-5-15:
  89. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-15' }}
  90. needs: fetch-commits
  91. uses: ./.github/workflows/prepare.yml
  92. with:
  93. config_file: .github/kernel-config/a13-5.15.json
  94. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  95. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  96. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  97. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  98. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  99. secrets: inherit
  100. build-a14-5-15:
  101. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-5-15' }}
  102. needs: fetch-commits
  103. uses: ./.github/workflows/prepare.yml
  104. with:
  105. config_file: .github/kernel-config/a14-5.15.json
  106. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  107. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  108. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  109. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  110. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  111. secrets: inherit
  112. build-a14-6-1:
  113. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-6-1' }}
  114. needs: fetch-commits
  115. uses: ./.github/workflows/prepare.yml
  116. with:
  117. config_file: .github/kernel-config/a14-6.1.json
  118. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  119. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  120. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  121. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  122. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  123. secrets: inherit
  124. build-a15-6-6:
  125. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a15-6-6' }}
  126. needs: fetch-commits
  127. uses: ./.github/workflows/prepare.yml
  128. with:
  129. config_file: .github/kernel-config/a15-6.6.json
  130. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  131. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  132. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  133. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  134. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  135. secrets: inherit
  136. build-a16-6-12:
  137. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a16-6-12' }}
  138. needs: fetch-commits
  139. uses: ./.github/workflows/prepare.yml
  140. with:
  141. config_file: .github/kernel-config/a16-6.12.json
  142. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  143. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  144. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  145. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  146. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  147. secrets: inherit
  148. build-lts:
  149. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'lts' || github.event_name == 'push' }}
  150. needs: fetch-commits
  151. uses: ./.github/workflows/prepare.yml
  152. with:
  153. config_file: .github/kernel-config/lts.json
  154. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  155. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  156. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  157. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  158. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  159. secrets: inherit
  160. build-custom:
  161. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'custom' }}
  162. needs: fetch-commits
  163. uses: ./.github/workflows/prepare.yml
  164. with:
  165. config_file: .github/kernel-config/custom.json
  166. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  167. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  168. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  169. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  170. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  171. secrets: inherit
  172. build-testing:
  173. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'testing' || github.event_name == 'push' }}
  174. needs: fetch-commits
  175. uses: ./.github/workflows/prepare.yml
  176. with:
  177. config_file: .github/kernel-config/testing.json
  178. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  179. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  180. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  181. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  182. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  183. secrets: inherit
  184. build-bypass:
  185. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'bypass' }}
  186. needs: fetch-commits
  187. uses: ./.github/workflows/prepare.yml
  188. with:
  189. config_file: .github/kernel-config/bypass.json
  190. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  191. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  192. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  193. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  194. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  195. secrets: inherit
  196. rej:
  197. if: always()
  198. runs-on: ubuntu-latest
  199. permissions:
  200. actions: read
  201. contents: read
  202. needs:
  203. - build-a12-5-10
  204. - build-a13-5-10
  205. - build-a13-5-15
  206. - build-a14-5-15
  207. - build-a14-6-1
  208. - build-a15-6-6
  209. - build-a16-6-12
  210. - build-custom
  211. - build-lts
  212. - build-testing
  213. - build-bypass
  214. steps:
  215. - name: Download Misc Artifacts
  216. uses: actions/download-artifact@v4
  217. with:
  218. path: ./downloaded-artifacts
  219. pattern: '*-Rejects'
  220. merge-multiple: false
  221. - name: Process Reject Artifacts
  222. run: |
  223. mkdir -p aio-rejects
  224. # Iterate over Rejects artifacts in downloaded-artifacts
  225. for dir in ./downloaded-artifacts/*-Rejects; do
  226. # Ensure it is a directory
  227. [ -d "$dir" ] || continue
  228. dirname=$(basename "$dir")
  229. # Process each reject artifact
  230. # Get original name (remove -Rejects suffix)
  231. original_name=${dirname%-Rejects}
  232. mkdir -p "aio-rejects/$original_name"
  233. # Check for patch-rejects folder (legacy structure) or direct contents
  234. if [ -d "$dir/patch-rejects" ]; then
  235. # Legacy structure
  236. cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
  237. else
  238. # Current structure
  239. cp -r "$dir/." "aio-rejects/$original_name/"
  240. fi
  241. done
  242. # Zip and upload if we found anything
  243. if [ "$(ls -A aio-rejects)" ]; then
  244. # Create a single zip of all rejects
  245. cd aio-rejects
  246. zip -r -q -9 ../AIO-REJ.zip .
  247. cd ..
  248. else
  249. echo "No rejects found to upload."
  250. fi
  251. - name: Upload AIO-REJ Artifact
  252. uses: actions/upload-artifact@v4
  253. with:
  254. name: AIO-REJ
  255. path: AIO-REJ.zip
  256. if-no-files-found: ignore
  257. release:
  258. runs-on: ubuntu-latest
  259. if: ${{ github.event_name == 'workflow_dispatch' && inputs.release_type != 'Actions' }}
  260. permissions:
  261. contents: write
  262. needs:
  263. - build-a12-5-10
  264. - build-a13-5-10
  265. - build-a13-5-15
  266. - build-a14-5-15
  267. - build-a14-6-1
  268. - build-a15-6-6
  269. - build-a16-6-12
  270. - build-lts
  271. - build-custom
  272. - build-bypass
  273. env:
  274. GH_TOKEN: ${{ github.token }}
  275. RELEASE_NAME: "GKI Kernels With WKSU & SUSFS v2.0.0"
  276. RELEASE_BODY: ""
  277. outputs:
  278. new_tag: ${{ steps.tag.outputs.new_tag }}
  279. steps:
  280. - name: Validate Selected Builds
  281. run: |
  282. set -euo pipefail
  283. failed=0
  284. current_type="${{ inputs.kernel_build_version }}"
  285. check_selected() {
  286. local target="$1"
  287. local job_name="$2"
  288. local result="$3"
  289. if [[ "$current_type" == "all" || "$current_type" == "$target" ]]; then
  290. if [[ "$result" != "success" ]]; then
  291. echo "Required job $job_name did not succeed (result: $result)"
  292. failed=1
  293. fi
  294. fi
  295. }
  296. check_selected "a12-5-10" "build-a12-5-10" "${{ needs.build-a12-5-10.result }}"
  297. check_selected "a13-5-10" "build-a13-5-10" "${{ needs.build-a13-5-10.result }}"
  298. check_selected "a13-5-15" "build-a13-5-15" "${{ needs.build-a13-5-15.result }}"
  299. check_selected "a14-5-15" "build-a14-5-15" "${{ needs.build-a14-5-15.result }}"
  300. check_selected "a14-6-1" "build-a14-6-1" "${{ needs.build-a14-6-1.result }}"
  301. check_selected "a15-6-6" "build-a15-6-6" "${{ needs.build-a15-6-6.result }}"
  302. check_selected "a16-6-12" "build-a16-6-12" "${{ needs.build-a16-6-12.result }}"
  303. check_selected "custom" "build-custom" "${{ needs.build-custom.result }}"
  304. check_selected "lts" "build-lts" "${{ needs.build-lts.result }}"
  305. check_selected "bypass" "build-bypass" "${{ needs.build-bypass.result }}"
  306. if [[ "$failed" -ne 0 ]]; then
  307. exit 1
  308. fi
  309. - name: Free Disk Space
  310. if: true
  311. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  312. with:
  313. remove_android: true
  314. remove_dotnet: true
  315. remove_haskell: true
  316. remove_tool_cache: true
  317. remove_swap: true
  318. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  319. remove_packages_one_command: true
  320. 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"
  321. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  322. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  323. testing: false
  324. - name: Checkout code
  325. uses: actions/checkout@v4
  326. - name: Generate New Tag
  327. id: tag
  328. if: inputs.release_type != 'Actions'
  329. run: |
  330. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "v0.0.0")
  331. if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then
  332. LATEST_TAG="v0.0.0"
  333. fi
  334. if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
  335. VERSION="${BASH_REMATCH[1]}"
  336. REV="${BASH_REMATCH[2]}"
  337. NEW_REV=$((REV + 1))
  338. NEW_TAG="${VERSION}-r${NEW_REV}"
  339. else
  340. NEW_TAG="${LATEST_TAG}-r1"
  341. fi
  342. echo "Latest tag: $LATEST_TAG"
  343. echo "New tag: $NEW_TAG"
  344. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  345. echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
  346. - name: Set release body
  347. run: |
  348. cat << 'EOF' > release_body.md
  349. **IMPORTANT DISCLAIMER**
  350. This software is provided for testing and educational purposes only. Use at your own risk.
  351. The developers are not responsible for any damage, data loss, or issues that may occur.
  352. Please ensure you have proper backups before installation.
  353. Features:
  354. -> Wild KSU Manager Support, Also Compatible with KernelSU-Next Manager
  355. -> SUSFS ඞ v2.0.0
  356. -> SUSFS Inline Hooks
  357. -> IPSet Support for Advanced Network Filtering
  358. -> BBRv1 TCP Congestion Control
  359. -> BBG: https://github.com/vc-teahouse/Baseband-guard
  360. 🔹 BBG (Baseband-guard)
  361. - A lightweight LSM (Linux Security Module) for Android kernel
  362. - Blocks unauthorized writes to critical partitions/device nodes
  363. - Prevents malicious tampering with baseband and boot chain
  364. - Kernel-level protection via LSM hooks
  365. - Reduces risk of soft-brick/hard-brick issues
  366. 🔹 Bypass Builds
  367. - Includes module check bypass modifications
  368. - What are kernel modules? Kernel modules are pieces of code that can be loaded into the kernel at runtime to extend functionality (like device drivers, filesystem support, etc.). These are different from KernelSU/Magisk modules.
  369. - The Problem: Sometimes when installing a custom kernel, the device tries to load a kernel module that fails due to version mismatches, missing dependencies, or signature verification issues. This can cause boot failures or device instability.
  370. - The Solution: These versions change one line from false to true to force load the kernel module, bypassing the failure check that would normally prevent loading.
  371. Kernel Flasher:
  372. -> https://github.com/fatalcoder524/KernelFlasher/
  373. Manager:
  374. -> Wild KSU Manager: https://github.com/WildKernels/Wild_KSU
  375. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  376. Module:
  377. -> https://github.com/sidex15/ksu_module_susfs
  378. EOF
  379. - name: Create Release
  380. uses: softprops/action-gh-release@v1
  381. with:
  382. tag_name: ${{ steps.tag.outputs.new_tag }}
  383. name: ${{ steps.tag.outputs.new_tag }}
  384. body_path: release_body.md
  385. draft: false
  386. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  387. files: |
  388. AnyKernel3/**/*.zip
  389. AIO-REJ.zip