main.yml 14 KB

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