main.yml 16 KB

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