main.yml 14 KB

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