main.yml 11 KB

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