main.yml 14 KB

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