main.yml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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_variant:
  14. description: "KernelSU Variant"
  15. type: choice
  16. options: [ KSU, WKSU, Next, RKSU]
  17. default: WKSU
  18. ksu_commit:
  19. description: "KSU Commit (optional)"
  20. type: string
  21. default: ""
  22. required: false
  23. build_bypass:
  24. description: "Build Bypass"
  25. type: boolean
  26. default: false
  27. # Build Selection
  28. build_a12_5_10:
  29. description: "Android 12 - 5.10"
  30. type: boolean
  31. default: false
  32. build_a13_5_10:
  33. description: "Android 13 - 5.10"
  34. type: boolean
  35. default: false
  36. build_a13_5_15:
  37. description: "Android 13 - 5.15"
  38. type: boolean
  39. default: false
  40. build_a14_5_15:
  41. description: "Android 14 - 5.15"
  42. type: boolean
  43. default: false
  44. build_a14_6_1:
  45. description: "Android 14 - 6.1"
  46. type: boolean
  47. default: false
  48. build_a15_6_6:
  49. description: "Android 15 - 6.6"
  50. type: boolean
  51. default: false
  52. build_a16_6_12:
  53. description: "Android 16 - 6.12"
  54. type: boolean
  55. default: false
  56. build_custom:
  57. description: "Custom Builds"
  58. type: boolean
  59. default: true
  60. build_lts:
  61. description: "Build All LTS Kernels"
  62. type: boolean
  63. default: false
  64. jobs:
  65. build-a12-5-10:
  66. if: inputs.build_a12_5_10
  67. uses: ./.github/workflows/kernel-a12-5-10.yml
  68. secrets: inherit
  69. with:
  70. ksu_variant: ${{ inputs.ksu_variant }}
  71. ksu_commit: ${{ inputs.ksu_commit }}
  72. build_bypass: ${{ inputs.build_bypass }}
  73. build-a13-5-10:
  74. if: inputs.build_a13_5_10
  75. uses: ./.github/workflows/kernel-a13-5-10.yml
  76. secrets: inherit
  77. with:
  78. ksu_variant: ${{ inputs.ksu_variant }}
  79. ksu_commit: ${{ inputs.ksu_commit }}
  80. build_bypass: ${{ inputs.build_bypass }}
  81. build-a13-5-15:
  82. if: inputs.build_a13_5_15
  83. uses: ./.github/workflows/kernel-a13-5-15.yml
  84. secrets: inherit
  85. with:
  86. ksu_variant: ${{ inputs.ksu_variant }}
  87. ksu_commit: ${{ inputs.ksu_commit }}
  88. build_bypass: ${{ inputs.build_bypass }}
  89. build-a14-5-15:
  90. if: inputs.build_a14_5_15
  91. uses: ./.github/workflows/kernel-a14-5-15.yml
  92. secrets: inherit
  93. with:
  94. ksu_variant: ${{ inputs.ksu_variant }}
  95. ksu_commit: ${{ inputs.ksu_commit }}
  96. build_bypass: ${{ inputs.build_bypass }}
  97. build-a14-6-1:
  98. if: inputs.build_a14_6_1
  99. uses: ./.github/workflows/kernel-a14-6-1.yml
  100. secrets: inherit
  101. with:
  102. ksu_variant: ${{ inputs.ksu_variant }}
  103. ksu_commit: ${{ inputs.ksu_commit }}
  104. build_bypass: ${{ inputs.build_bypass }}
  105. build-a15-6-6:
  106. if: inputs.build_a15_6_6
  107. uses: ./.github/workflows/kernel-a15-6-6.yml
  108. secrets: inherit
  109. with:
  110. ksu_variant: ${{ inputs.ksu_variant }}
  111. ksu_commit: ${{ inputs.ksu_commit }}
  112. build_bypass: ${{ inputs.build_bypass }}
  113. build-a16-6-12:
  114. if: inputs.build_a16_6_12
  115. uses: ./.github/workflows/kernel-a16-612.yml
  116. secrets: inherit
  117. with:
  118. ksu_variant: ${{ inputs.ksu_variant }}
  119. ksu_commit: ${{ inputs.ksu_commit }}
  120. build_bypass: ${{ inputs.build_bypass }}
  121. build-custom:
  122. if: inputs.build_custom
  123. uses: ./.github/workflows/kernel-custom.yml
  124. secrets: inherit
  125. with:
  126. ksu_variant: ${{ inputs.ksu_variant }}
  127. ksu_commit: ${{ inputs.ksu_commit }}
  128. build_bypass: ${{ inputs.build_bypass }}
  129. build-lts:
  130. if: inputs.build_lts
  131. uses: ./.github/workflows/kernel-lts.yml
  132. secrets: inherit
  133. with:
  134. ksu_variant: ${{ inputs.ksu_variant }}
  135. ksu_commit: ${{ inputs.ksu_commit }}
  136. build_bypass: ${{ inputs.build_bypass }}
  137. rej:
  138. if: always()
  139. runs-on: ubuntu-latest
  140. needs:
  141. - build-a12-5-10
  142. - build-a13-5-10
  143. - build-a13-5-15
  144. - build-a14-5-15
  145. - build-a14-6-1
  146. - build-a15-6-6
  147. - build-a16-6-12
  148. - build-custom
  149. - build-lts
  150. steps:
  151. - name: Download Misc Artifacts
  152. uses: actions/download-artifact@v5
  153. with:
  154. path: ./downloaded-artifacts
  155. pattern: '*-Rejects'
  156. - name: Process Reject Artifacts
  157. run: |
  158. mkdir -p aio-rejects
  159. # Iterate over Rejects artifacts in downloaded-artifacts
  160. for dir in ./downloaded-artifacts/*-Rejects; do
  161. # Ensure it is a directory
  162. [ -d "$dir" ] || continue
  163. dirname=$(basename "$dir")
  164. echo "Processing $dirname..."
  165. # Get original name (remove -Rejects suffix)
  166. original_name=${dirname%-Rejects}
  167. mkdir -p "aio-rejects/$original_name"
  168. # Check for patch-rejects folder (legacy structure) or direct contents
  169. if [ -d "$dir/patch-rejects" ]; then
  170. echo "Found patch-rejects subdir in $dirname"
  171. cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
  172. else
  173. echo "Copying contents from $dirname"
  174. cp -r "$dir/." "aio-rejects/$original_name/"
  175. fi
  176. done
  177. # Zip and upload if we found anything
  178. if [ "$(ls -A aio-rejects)" ]; then
  179. echo "Creating AIO-REJ.zip..."
  180. cd aio-rejects
  181. zip -r -q -9 ../AIO-REJ.zip .
  182. cd ..
  183. else
  184. echo "No rejects found to upload."
  185. fi
  186. - name: Upload AIO-REJ Artifact
  187. uses: actions/upload-artifact@v4
  188. with:
  189. name: AIO-REJ
  190. path: AIO-REJ.zip
  191. if-no-files-found: ignore
  192. release:
  193. runs-on: ubuntu-latest
  194. if: inputs.release_type != 'Actions'
  195. permissions:
  196. contents: write
  197. needs:
  198. - build-a12-5-10
  199. - build-a13-5-10
  200. - build-a13-5-15
  201. - build-a14-5-15
  202. - build-a14-6-1
  203. - build-a15-6-6
  204. - build-a16-6-12
  205. - build-custom
  206. - build-lts
  207. env:
  208. GH_TOKEN: ${{ github.token }}
  209. RELEASE_NAME: "!!TESTING!! GKI Kernels With KernelSU-Next & SUSFS v2.0.0 !!TESTING!!"
  210. RELEASE_BODY: ""
  211. outputs:
  212. new_tag: ${{ steps.tag.outputs.new_tag }}
  213. steps:
  214. - name: Free Disk Space
  215. if: true
  216. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  217. with:
  218. remove_android: true
  219. remove_dotnet: true
  220. remove_haskell: true
  221. remove_tool_cache: true
  222. remove_swap: true
  223. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  224. remove_packages_one_command: true
  225. 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"
  226. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  227. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  228. testing: false
  229. - name: Checkout code
  230. uses: actions/checkout@v4
  231. - name: Generate New Tag
  232. if: inputs.release_type != 'Actions'
  233. run: |
  234. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  235. if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
  236. VERSION="${BASH_REMATCH[1]}"
  237. REV="${BASH_REMATCH[2]}"
  238. NEW_REV=$((REV + 1))
  239. NEW_TAG="${VERSION}-r${NEW_REV}"
  240. else
  241. NEW_TAG="${LATEST_TAG}-r1"
  242. fi
  243. echo "New tag: $NEW_TAG"
  244. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  245. - name: Set release body
  246. run: |
  247. cat << 'EOF' > release_body.md
  248. !!THIS RELEASE IS A TESTING RELEASE!!
  249. **IMPORTANT DISCLAIMER**
  250. This software is provided for testing and educational purposes only. Use at your own risk.
  251. The developers are not responsible for any damage, data loss, or issues that may occur.
  252. Please ensure you have proper backups before installation.
  253. 🔹 Normal
  254. - Default kernel configuration
  255. - Standard kernel module loading behavior
  256. - Recommended for most users
  257. 🔹 Bypass
  258. - Includes module check bypass modifications
  259. - 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.
  260. - 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.
  261. - 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.
  262. Features:
  263. -> Wild KSU Manager Support, Also Compatible with KernelSU-Next Manager
  264. -> SUSFS ඞ v2.0.0
  265. -> SUSFS Inline Hooks
  266. -> Ptrace Patch Support for Older Kernels (<5.16)
  267. -> IPSet Support for Advanced Network Filtering
  268. -> Wireguard Support
  269. -> BBR v1 Support
  270. -> BBG: https://github.com/vc-teahouse/Baseband-guard
  271. 🔹 BBG (Baseband-guard)
  272. - A lightweight LSM (Linux Security Module) for Android kernel
  273. - Blocks unauthorized writes to critical partitions/device nodes
  274. - Prevents malicious tampering with baseband and boot chain
  275. - Kernel-level protection via LSM hooks
  276. - Reduces risk of soft-brick/hard-brick issues
  277. Kernel Flasher:
  278. -> https://github.com/fatalcoder524/KernelFlasher/
  279. Manager:
  280. -> Wild KSU Manager: https://github.com/WildKernels/Wild_KSU
  281. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  282. Module:
  283. -> https://github.com/sidex15/ksu_module_susfs
  284. !!THIS RELEASE IS A TESTING RELEASE!!
  285. EOF
  286. - name: Create GitHub Release
  287. run: |
  288. PRERELEASE_FLAG=""
  289. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  290. PRERELEASE_FLAG="--prerelease"
  291. fi
  292. echo "Creating release ${{ env.NEW_TAG }}..."
  293. gh release create "${{ env.NEW_TAG }}" \
  294. --title "${{ env.RELEASE_NAME }}" \
  295. --notes-file release_body.md \
  296. --target "${{ github.sha }}" \
  297. $PRERELEASE_FLAG
  298. - name: Download Artifacts
  299. uses: actions/download-artifact@v5
  300. with:
  301. path: ./downloaded-artifacts
  302. pattern: '*-AnyKernel3'
  303. - name: Upload Release Assets
  304. if:
  305. run: |+
  306. shopt -s nullglob
  307. mapfile -t anykernel_dirs < <(find ./downloaded-artifacts -maxdepth 2 -type d -name '*-AnyKernel3' -print)
  308. mapfile -t anykernel_zips < <(find ./downloaded-artifacts -maxdepth 2 -type f -name '*-AnyKernel3*.zip' -print)
  309. if [ ${#anykernel_dirs[@]} -eq 0 ] && [ ${#anykernel_zips[@]} -eq 0 ]; then
  310. echo "No AnyKernel3 artifact directories found; skipping upload."
  311. ls -al ./downloaded-artifacts || true
  312. exit 0
  313. fi
  314. if [ ${#anykernel_dirs[@]} -gt 0 ]; then
  315. echo "Found ${#anykernel_dirs[@]} directory artifact(s) to process"
  316. for dir in "${anykernel_dirs[@]}"; do
  317. artifact_name=$(basename "$dir")
  318. echo "Creating ZIP for $artifact_name..."
  319. (cd "$dir" && zip -r -q -9 "$GITHUB_WORKSPACE/${artifact_name}.zip" ./*) &
  320. done
  321. wait
  322. fi
  323. for zip_path in "${anykernel_zips[@]}"; do
  324. echo "Uploading $(basename "$zip_path")..."
  325. gh release upload "${{ env.NEW_TAG }}" "$zip_path" --clobber
  326. done
  327. for dir in "${anykernel_dirs[@]}"; do
  328. artifact_name=$(basename "$dir")
  329. echo "Uploading ${artifact_name}.zip..."
  330. gh release upload "${{ env.NEW_TAG }}" "$GITHUB_WORKSPACE/${artifact_name}.zip" --clobber
  331. done
  332. notify-actions:
  333. runs-on: ubuntu-latest
  334. needs: [release]
  335. if: always()
  336. env:
  337. NEW_TAG: ${{ needs.release.outputs.new_tag }}
  338. steps:
  339. - name: Download TheWildJames Artifacts
  340. uses: actions/download-artifact@v5
  341. with:
  342. path: ./downloaded-artifacts/6.1.145-android14-2025-09-TheWildJames-AnyKernel3
  343. pattern: '6.1.145-android14-2025-09-TheWildJames-AnyKernel3'
  344. - name: Download Normal Artifacts
  345. uses: actions/download-artifact@v5
  346. with:
  347. path: ./downloaded-artifacts/6.1.145-android14-2025-09-Normal-AnyKernel3
  348. pattern: '6.1.145-android14-2025-09-Normal-AnyKernel3'
  349. - name: Setup Release Assets
  350. if:
  351. run: |+
  352. shopt -s nullglob
  353. mapfile -t anykernel_dirs < <(find ./downloaded-artifacts -maxdepth 2 -type d -name '*-AnyKernel3' -print)
  354. mapfile -t anykernel_zips < <(find ./downloaded-artifacts -maxdepth 2 -type f -name '*-AnyKernel3*.zip' -print)
  355. if [ ${#anykernel_dirs[@]} -eq 0 ] && [ ${#anykernel_zips[@]} -eq 0 ]; then
  356. echo "No AnyKernel3 artifact directories found; skipping upload."
  357. ls -al ./downloaded-artifacts || true
  358. exit 0
  359. fi
  360. if [ ${#anykernel_zips[@]} -gt 0 ]; then
  361. for zip_path in "${anykernel_zips[@]}"; do
  362. echo "Copying $(basename "$zip_path") to workspace root..."
  363. cp -f "$zip_path" "$GITHUB_WORKSPACE/$(basename "$zip_path")"
  364. done
  365. fi
  366. if [ ${#anykernel_dirs[@]} -gt 0 ]; then
  367. echo "Found ${#anykernel_dirs[@]} directory artifact(s) to process"
  368. for dir in "${anykernel_dirs[@]}"; do
  369. artifact_name=$(basename "$dir")
  370. echo "Creating ZIP for $artifact_name..."
  371. (cd "$dir" && zip -r -q -9 "$GITHUB_WORKSPACE/${artifact_name}.zip" ./*) &
  372. done
  373. wait
  374. fi
  375. - name: Send Telegram Notification
  376. if: inputs.release_type == 'Actions'
  377. run: |
  378. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  379. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  380. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  381. -F text="
  382. 🌽 *New Kernel Actions Build Finished*
  383. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  384. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  385. [🔗 View Action Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" \
  386. -F parse_mode="Markdown"
  387. - name: Send Telegram Notification
  388. if: inputs.release_type != 'Actions' && needs.release.result == 'success'
  389. run: |
  390. RELEASE_TYPE_TEXT=""
  391. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  392. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  393. else
  394. RELEASE_TYPE_TEXT="🚀 *Release*"
  395. fi
  396. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  397. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  398. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  399. -F text="
  400. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  401. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  402. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  403. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  404. -F parse_mode="Markdown"
  405. - name: DM Artifacts
  406. if: always()
  407. run: |
  408. shopt -s nullglob
  409. # Check for TheWildJames and Normal artifacts
  410. files=(./*.zip)
  411. if [ ${#files[@]} -eq 0 ]; then
  412. echo "No zip files found for DM."
  413. exit 0
  414. fi
  415. if [ -z "${{ secrets.TELEGRAM_USER_ID }}" ]; then
  416. echo "Error: TELEGRAM_USER_ID secret is not set."
  417. exit 1
  418. fi
  419. for file in "${files[@]}"; do
  420. if [ -f "$file" ]; then
  421. echo "Sending $file to Telegram DM..."
  422. curl -v -F chat_id="${{ secrets.TELEGRAM_USER_ID }}" \
  423. -F document=@"$file" \
  424. -F caption="📦 **Build**: $(basename "$file")" \
  425. -F parse_mode="Markdown" \
  426. https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
  427. fi
  428. done