main.yml 11 KB

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