main.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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. env:
  207. GH_TOKEN: ${{ github.token }}
  208. RELEASE_NAME: "!!TESTING!! GKI Kernels With KernelSU-Next & SUSFS v2.0.0 !!TESTING!!"
  209. RELEASE_BODY: ""
  210. steps:
  211. - name: Free Disk Space
  212. if: true
  213. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  214. with:
  215. remove_android: true
  216. remove_dotnet: true
  217. remove_haskell: true
  218. remove_tool_cache: true
  219. remove_swap: true
  220. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  221. remove_packages_one_command: true
  222. 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"
  223. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  224. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  225. testing: false
  226. - name: Checkout code
  227. uses: actions/checkout@v4
  228. - name: Generate New Tag
  229. if: inputs.release_type != 'Actions'
  230. run: |
  231. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  232. if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
  233. VERSION="${BASH_REMATCH[1]}"
  234. REV="${BASH_REMATCH[2]}"
  235. NEW_REV=$((REV + 1))
  236. NEW_TAG="${VERSION}-r${NEW_REV}"
  237. else
  238. NEW_TAG="${LATEST_TAG}-r1"
  239. fi
  240. echo "New tag: $NEW_TAG"
  241. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  242. - name: Set release body
  243. run: |
  244. cat << 'EOF' > release_body.md
  245. !!THIS RELEASE IS A TESTING RELEASE!!
  246. **IMPORTANT DISCLAIMER**
  247. This software is provided for testing and educational purposes only. Use at your own risk.
  248. The developers are not responsible for any damage, data loss, or issues that may occur.
  249. Please ensure you have proper backups before installation.
  250. 🔹 Normal
  251. - Default kernel configuration
  252. - Standard kernel module loading behavior
  253. - Recommended for most users
  254. 🔹 Bypass
  255. - Includes module check bypass modifications
  256. - 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.
  257. - 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.
  258. - 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.
  259. Features:
  260. -> Wild KSU Manager Support, Also Compatible with KernelSU-Next Manager
  261. -> SUSFS ඞ v2.0.0
  262. -> SUSFS Inline Hooks
  263. -> Ptrace Patch Support for Older Kernels (<5.16)
  264. -> IPSet Support for Advanced Network Filtering
  265. -> Wireguard Support
  266. -> BBR v1 Support
  267. -> BBG: https://github.com/vc-teahouse/Baseband-guard
  268. 🔹 BBG (Baseband-guard)
  269. - A lightweight LSM (Linux Security Module) for Android kernel
  270. - Blocks unauthorized writes to critical partitions/device nodes
  271. - Prevents malicious tampering with baseband and boot chain
  272. - Kernel-level protection via LSM hooks
  273. - Reduces risk of soft-brick/hard-brick issues
  274. Kernel Flasher:
  275. -> https://github.com/fatalcoder524/KernelFlasher/
  276. Manager:
  277. -> Wild KSU Manager: https://github.com/WildKernels/Wild_KSU
  278. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  279. Module:
  280. -> https://github.com/sidex15/ksu_module_susfs
  281. !!THIS RELEASE IS A TESTING RELEASE!!
  282. EOF
  283. - name: Create GitHub Release
  284. run: |
  285. PRERELEASE_FLAG=""
  286. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  287. PRERELEASE_FLAG="--prerelease"
  288. fi
  289. echo "Creating release ${{ env.NEW_TAG }}..."
  290. gh release create "${{ env.NEW_TAG }}" \
  291. --title "${{ env.RELEASE_NAME }}" \
  292. --notes-file release_body.md \
  293. --target "${{ github.sha }}" \
  294. $PRERELEASE_FLAG
  295. - name: Download Artifacts
  296. uses: actions/download-artifact@v5
  297. with:
  298. path: ./downloaded-artifacts
  299. pattern: '*-AnyKernel3'
  300. - name: Upload Release Assets
  301. if:
  302. run: |+
  303. shopt -s nullglob
  304. anykernel_dirs=(./downloaded-artifacts/*-AnyKernel3/)
  305. if [ ${#anykernel_dirs[@]} -eq 0 ]; then
  306. echo "No AnyKernel3 artifact directories found; skipping upload."
  307. exit 0
  308. fi
  309. echo "Found ${#anykernel_dirs[@]} artifacts to process"
  310. # Create all ZIPs in parallel
  311. for dir in "${anykernel_dirs[@]}"; do
  312. artifact_name=$(basename "$dir")
  313. echo "Creating ZIP for $artifact_name..."
  314. (cd "$dir" && zip -r -q -9 "$GITHUB_WORKSPACE/${artifact_name}.zip" ./*) &
  315. done
  316. wait
  317. # Upload all ZIPs
  318. for dir in "${anykernel_dirs[@]}"; do
  319. artifact_name=$(basename "$dir")
  320. echo "Uploading ${artifact_name}.zip..."
  321. gh release upload "${{ env.NEW_TAG }}" "${artifact_name}.zip" --clobber
  322. done
  323. - name: Send Telegram Notification
  324. if: inputs.release_type != 'Actions'
  325. run: |
  326. RELEASE_TYPE_TEXT=""
  327. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  328. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  329. else
  330. RELEASE_TYPE_TEXT="🚀 *Release*"
  331. fi
  332. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  333. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  334. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  335. -F text="
  336. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  337. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  338. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  339. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  340. -F parse_mode="Markdown"
  341. notify-actions:
  342. runs-on: ubuntu-latest
  343. steps:
  344. - name: Send Telegram Notification
  345. if: inputs.release_type == 'Actions'
  346. run: |
  347. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  348. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  349. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  350. -F text="
  351. 🌽 *New Kernel Actions Build Finished*
  352. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  353. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  354. [🔗 View Action Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" \
  355. -F parse_mode="Markdown"
  356. - name: Send Telegram Notification
  357. if: inputs.release_type != 'Actions'
  358. run: |
  359. RELEASE_TYPE_TEXT=""
  360. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  361. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  362. else
  363. RELEASE_TYPE_TEXT="🚀 *Release*"
  364. fi
  365. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  366. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  367. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  368. -F text="
  369. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  370. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  371. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  372. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  373. -F parse_mode="Markdown"
  374. - name: DM Artifacts
  375. if: always()
  376. run: |
  377. # Check for TheWildJames and Normal artifacts
  378. for file in ./*TheWildJames*.zip ./*Normal*.zip; do
  379. if [ -f "$file" ]; then
  380. echo "Sending $file to Telegram DM..."
  381. curl -F chat_id="${{ secrets.TELEGRAM_USER_ID }}" \
  382. -F document=@"$file" \
  383. -F caption="📦 **Build**: $file" \
  384. -F parse_mode="Markdown" \
  385. https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
  386. fi
  387. done