main.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. name: Build Kernels
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. # push:
  7. # branches:
  8. # - main
  9. # paths:
  10. # - '.github/workflows/**'
  11. # pull_request:
  12. # branches:
  13. # - main
  14. # paths:
  15. # - '.github/workflows/**'
  16. workflow_dispatch:
  17. inputs:
  18. release_type:
  19. description: "Choose Release Type"
  20. required: true
  21. type: choice
  22. options:
  23. - Actions
  24. - Pre-Release
  25. - Release
  26. - Release (No Artifacts)
  27. default: Actions
  28. build_selection:
  29. description: "Choose which kernels to build"
  30. required: true
  31. type: choice
  32. options:
  33. - All
  34. - Android12-5.10
  35. - Android13-5.10
  36. - Android13-5.15
  37. - Android14-5.15
  38. - Android14-6.1
  39. - Android15-6.6
  40. default: All
  41. susfs_version:
  42. description: "Choose SUSFS version to build"
  43. required: true
  44. type: choice
  45. options:
  46. - v1.5.12
  47. - v1.5.9
  48. default: v1.5.12
  49. jobs:
  50. build-a12-5-10:
  51. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android12-5.10') && inputs.release_type != 'Release (No Artifacts)'
  52. uses: ./.github/workflows/kernel-a12-5-10.yml
  53. secrets: inherit
  54. with:
  55. susfs_version: ${{ inputs.susfs_version }}
  56. build-a13-5-10:
  57. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android13-5.10') && inputs.release_type != 'Release (No Artifacts)'
  58. uses: ./.github/workflows/kernel-a13-5-10.yml
  59. secrets: inherit
  60. with:
  61. susfs_version: ${{ inputs.susfs_version }}
  62. build-a13-5-15:
  63. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android13-5.15') && inputs.release_type != 'Release (No Artifacts)'
  64. uses: ./.github/workflows/kernel-a13-5-15.yml
  65. secrets: inherit
  66. with:
  67. susfs_version: ${{ inputs.susfs_version }}
  68. build-a14-5-15:
  69. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android14-5.15') && inputs.release_type != 'Release (No Artifacts)'
  70. uses: ./.github/workflows/kernel-a14-5-15.yml
  71. secrets: inherit
  72. with:
  73. susfs_version: ${{ inputs.susfs_version }}
  74. build-a14-6-1:
  75. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android14-6.1') && inputs.release_type != 'Release (No Artifacts)'
  76. uses: ./.github/workflows/kernel-a14-6-1.yml
  77. secrets: inherit
  78. with:
  79. susfs_version: ${{ inputs.susfs_version }}
  80. build-a15-6-6:
  81. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android15-6.6') && inputs.release_type != 'Release (No Artifacts)'
  82. uses: ./.github/workflows/kernel-a15-6-6.yml
  83. secrets: inherit
  84. with:
  85. susfs_version: ${{ inputs.susfs_version }}
  86. release:
  87. runs-on: ubuntu-latest
  88. if: inputs.build_selection == 'All' && inputs.release_type != 'Actions' && (inputs.release_type == 'Release (No Artifacts)' || success())
  89. needs:
  90. - build-a12-5-10
  91. - build-a13-5-10
  92. - build-a13-5-15
  93. - build-a14-5-15
  94. - build-a14-6-1
  95. - build-a15-6-6
  96. env:
  97. GH_TOKEN: ${{ github.token }}
  98. RELEASE_NAME: "GKI Kernels With WKSU & SUSFS v1.5.12"
  99. RELEASE_BODY: ""
  100. steps:
  101. # # - name: Maximize Build Space
  102. # uses: AdityaGarg8/remove-unwanted-software@v5
  103. # with:
  104. # remove-dotnet: 'true' # Frees ~2 GB
  105. # remove-android: 'true' # Frees ~9 GB
  106. # remove-haskell: 'true' # Frees ~5.2 GB
  107. # remove-codeql: 'true' # Frees ~5.4 GB
  108. # remove-docker-images: 'true' # Frees ~3.2 GB
  109. # remove-large-packages: 'true' # Frees ~3.1 GB
  110. # remove-swapfile: 'true' # Frees ~4 GB
  111. # remove-cached-tools: 'false' # Avoid unless confirmed safe
  112. # verbose: 'true' # Enable detailed logging
  113. - name: Checkout code
  114. uses: actions/checkout@v4
  115. - name: Get commit hashes and generate commit URLs
  116. run: |
  117. GITLAB_OWNER="simonpunk"
  118. GITLAB_REPO="susfs4ksu"
  119. declare -A BRANCH_MAP=(
  120. ["gki_android12_5_10"]="gki-android12-5.10"
  121. ["gki_android13_5_10"]="gki-android13-5.10"
  122. ["gki_android13_5_15"]="gki-android13-5.15"
  123. ["gki_android14_5_15"]="gki-android14-5.15"
  124. ["gki_android14_6_1"]="gki-android14-6.1"
  125. ["gki_android15_6_6"]="gki-android15-6.6"
  126. )
  127. for var_name in "${!BRANCH_MAP[@]}"; do
  128. branch_name="${BRANCH_MAP[$var_name]}"
  129. COMMIT_HASH=$(git ls-remote https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO.git refs/heads/$branch_name | awk '{ print $1 }')
  130. if [[ -n "$COMMIT_HASH" ]]; then
  131. COMMIT_URL="https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO/-/commit/$COMMIT_HASH"
  132. echo "$branch_name Commit: $COMMIT_HASH"
  133. echo "$branch_name Commit URL: $COMMIT_URL"
  134. echo "COMMIT_HASH_${var_name}=$COMMIT_HASH" >> "$GITHUB_ENV"
  135. echo "COMMIT_URL_${var_name}=$COMMIT_URL" >> "$GITHUB_ENV"
  136. fi
  137. done
  138. - name: Get KernelSU variant refs and links
  139. run: |
  140. # Get WKSU latest commit from wild branch
  141. WKSU_REF=$(git ls-remote "https://github.com/WildKernels/Wild_KSU.git" refs/heads/wild | awk '{print $1}')
  142. WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_REF"
  143. echo "WKSU_REF=$WKSU_REF" >> $GITHUB_ENV
  144. echo "WKSU_URL=$WKSU_URL" >> $GITHUB_ENV
  145. # Get Baseband-guard latest commit from main branch
  146. BBG_REF=$(git ls-remote "https://github.com/vc-teahouse/Baseband-guard.git" refs/heads/main | awk '{print $1}')
  147. BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_REF"
  148. echo "BBG_REF=$BBG_REF" >> $GITHUB_ENV
  149. echo "BBG_URL=$BBG_URL" >> $GITHUB_ENV
  150. - name: Generate New Tag
  151. if: inputs.release_type != 'Actions'
  152. run: |
  153. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  154. if [ -z "$LATEST_TAG" ]; then
  155. LATEST_TAG="v1.5.12-r0"
  156. fi
  157. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  158. echo "New tag: $NEW_TAG"
  159. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  160. - name: Set tag for Actions only
  161. if: inputs.release_type == 'Actions'
  162. run: |
  163. echo "NEW_TAG=actions-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
  164. - name: Download Artifacts
  165. if: inputs.release_type != 'Release (No Artifacts)'
  166. uses: actions/download-artifact@v5
  167. with:
  168. path: ./downloaded-artifacts
  169. pattern: 'WKSU-*-AnyKernel3'
  170. - name: Set release body
  171. run: |
  172. cat << 'EOF' > release_body.md
  173. **IMPORTANT DISCLAIMER**
  174. This software is provided for testing and educational purposes only. Use at your own risk.
  175. The developers are not responsible for any damage, data loss, or issues that may occur.
  176. Please ensure you have proper backups before installation.
  177. 🔹 Normal
  178. - Default kernel configuration
  179. - Standard kernel module loading behavior
  180. - Recommended for most users
  181. 🔹 Bypass
  182. - Includes module check bypass modifications
  183. - 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.
  184. - 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.
  185. - 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.
  186. 🔹 BBG (Baseband-guard)
  187. - A lightweight LSM (Linux Security Module) for Android kernel
  188. - Blocks unauthorized writes to critical partitions/device nodes
  189. - Prevents malicious tampering with baseband and boot chain
  190. - Kernel-level protection via LSM hooks
  191. - Reduces risk of soft-brick/hard-brick issues
  192. Features:
  193. -> Wild KSU
  194. -> Multi Manager Support for WKSU, KernelSU-Next! Needs Testing: KSU, MKSU RKSU, xxKSU, KowSU and SukiSU (Best compatibility with WKSU, no support will be provided for other managers)
  195. -> SUSFS ඞ v1.5.12
  196. -> Scope-Minimized Manual hooks v1.4
  197. -> Ptrace Patch Support for Older Kernels (<5.16)
  198. -> IPSet Support for Advanced Network Filtering
  199. -> Wireguard Support
  200. -> BBR v1 Support
  201. -> Added BBG support to prevent unauthorised writes to certain partitions: https://github.com/vc-teahouse/Baseband-guard
  202. Notes:
  203. -> SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  204. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/
  205. -> **boot.img files**: Available as CI artifacts only (not included in releases) - download from the Actions tab
  206. -> **Warning**: boot.img files may not boot on some Android 16 devices
  207. Module:
  208. -> https://github.com/sidex15/ksu_module_susfs
  209. Managers:
  210. -> WKSU: https://github.com/WildKernels/Wild_KSU
  211. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  212. Commit Hashes (at the time of release):
  213. -> WKSU: [${{ env.WKSU_REF }}](${{ env.WKSU_URL }})
  214. -> Baseband-guard: [${{ env.BBG_REF }}](${{ env.BBG_URL }})
  215. -> SUSFS4KSU:
  216. -> gki-android12-5.10: [${{ env.COMMIT_HASH_gki_android12_5_10 }}](${{ env.COMMIT_URL_gki_android12_5_10 }})
  217. -> gki-android13-5.10: [${{ env.COMMIT_HASH_gki_android13_5_10 }}](${{ env.COMMIT_URL_gki_android13_5_10 }})
  218. -> gki-android13-5.15: [${{ env.COMMIT_HASH_gki_android13_5_15 }}](${{ env.COMMIT_URL_gki_android13_5_15 }})
  219. -> gki-android14-5.15: [${{ env.COMMIT_HASH_gki_android14_5_15 }}](${{ env.COMMIT_URL_gki_android14_5_15 }})
  220. -> gki-android14-6.1: [${{ env.COMMIT_HASH_gki_android14_6_1 }}](${{ env.COMMIT_URL_gki_android14_6_1 }})
  221. -> gki-android15-6.6: [${{ env.COMMIT_HASH_gki_android15_6_6 }}](${{ env.COMMIT_URL_gki_android15_6_6 }})
  222. EOF
  223. - name: Create GitHub Release
  224. if: inputs.release_type != 'Actions'
  225. uses: softprops/action-gh-release@v2
  226. with:
  227. tag_name: ${{ env.NEW_TAG }}
  228. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  229. files: ""
  230. name: ${{ env.RELEASE_NAME }}
  231. body_path: release_body.md
  232. - name: Upload Release Assets
  233. if: inputs.release_type != 'Actions' && inputs.release_type != 'Release (No Artifacts)'
  234. run: |
  235. for dir in ./downloaded-artifacts/*/; do
  236. # Create ZIP files from AnyKernel3 directories
  237. if [ -d "$dir/AnyKernel3" ]; then
  238. artifact_name=$(basename "$dir")
  239. echo "Creating ZIP for $artifact_name..."
  240. cd "$dir"
  241. zip -r -9 "${artifact_name}-AnyKernel3.zip" AnyKernel3/
  242. echo "Uploading ${artifact_name}.zip..."
  243. gh release upload ${{ env.NEW_TAG }} "${artifact_name}-AnyKernel3.zip"
  244. cd - > /dev/null
  245. fi
  246. done
  247. - name: Display Files Uploaded
  248. if: inputs.release_type != 'Actions' && inputs.release_type != 'Release (No Artifacts)'
  249. run: |
  250. echo "GitHub release created with the following files:"
  251. ls ./downloaded-artifacts/**/*
  252. - name: Send Telegram Notification
  253. if: inputs.release_type != 'Actions'
  254. run: |
  255. RELEASE_TYPE_TEXT=""
  256. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  257. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  258. elif [ "${{ inputs.release_type }}" == "Release (No Artifacts)" ]; then
  259. RELEASE_TYPE_TEXT="🚀 *Release*"
  260. else
  261. RELEASE_TYPE_TEXT="🚀 *Release*"
  262. fi
  263. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  264. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  265. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  266. -F text="
  267. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  268. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  269. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  270. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  271. -F parse_mode="Markdown"