main.yml 15 KB

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