main.yml 13 KB

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