main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. NEW:
  178. -> **Module Check Bypass Variant**: Normal build with additional hack for compatibility, if you encounter any issues with the normal build try this!
  179. Features:
  180. -> Wild KSU
  181. -> 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)
  182. -> SUSFS ඞ v1.5.12
  183. -> Scope-Minimized Manual hooks v1.4
  184. -> Ptrace Patch Support for Older Kernels (<5.16)
  185. -> IPSet Support for Advanced Network Filtering
  186. -> Wireguard Support
  187. -> BBR v1 Support
  188. -> Added BBG support to prevent unauthorised writes to certain partitions: https://github.com/vc-teahouse/Baseband-guard
  189. Notes:
  190. -> SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  191. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/
  192. -> **boot.img files**: Available as CI artifacts only (not included in releases) - download from the Actions tab
  193. -> **Warning**: boot.img files may not boot on some Android 16 devices
  194. Module:
  195. -> https://github.com/sidex15/ksu_module_susfs
  196. Managers:
  197. -> WKSU: https://github.com/WildKernels/Wild_KSU
  198. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  199. Commit Hashes (at the time of release):
  200. -> WKSU: [${{ env.WKSU_REF }}](${{ env.WKSU_URL }})
  201. -> Baseband-guard: [${{ env.BBG_REF }}](${{ env.BBG_URL }})
  202. -> SUSFS4KSU:
  203. -> gki-android12-5.10: [${{ env.COMMIT_HASH_gki_android12_5_10 }}](${{ env.COMMIT_URL_gki_android12_5_10 }})
  204. -> gki-android13-5.10: [${{ env.COMMIT_HASH_gki_android13_5_10 }}](${{ env.COMMIT_URL_gki_android13_5_10 }})
  205. -> gki-android13-5.15: [${{ env.COMMIT_HASH_gki_android13_5_15 }}](${{ env.COMMIT_URL_gki_android13_5_15 }})
  206. -> gki-android14-5.15: [${{ env.COMMIT_HASH_gki_android14_5_15 }}](${{ env.COMMIT_URL_gki_android14_5_15 }})
  207. -> gki-android14-6.1: [${{ env.COMMIT_HASH_gki_android14_6_1 }}](${{ env.COMMIT_URL_gki_android14_6_1 }})
  208. -> gki-android15-6.6: [${{ env.COMMIT_HASH_gki_android15_6_6 }}](${{ env.COMMIT_URL_gki_android15_6_6 }})
  209. EOF
  210. - name: Create GitHub Release
  211. if: inputs.release_type != 'Actions'
  212. uses: softprops/action-gh-release@v2
  213. with:
  214. tag_name: ${{ env.NEW_TAG }}
  215. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  216. files: ""
  217. name: ${{ env.RELEASE_NAME }}
  218. body_path: release_body.md
  219. - name: Upload Release Assets
  220. if: inputs.release_type != 'Actions' && inputs.release_type != 'Release (No Artifacts)'
  221. run: |
  222. for dir in ./downloaded-artifacts/*/; do
  223. # Create ZIP files from AnyKernel3 directories
  224. if [ -d "$dir/AnyKernel3" ]; then
  225. artifact_name=$(basename "$dir")
  226. echo "Creating ZIP for $artifact_name..."
  227. cd "$dir"
  228. zip -r -9 "${artifact_name}-AnyKernel3.zip" AnyKernel3/
  229. echo "Uploading ${artifact_name}.zip..."
  230. gh release upload ${{ env.NEW_TAG }} "${artifact_name}-AnyKernel3.zip"
  231. cd - > /dev/null
  232. fi
  233. done
  234. - name: Display Files Uploaded
  235. if: inputs.release_type != 'Actions'
  236. run: |
  237. echo "GitHub release created with the following files:"
  238. ls ./downloaded-artifacts/**/*
  239. - name: Send Telegram Notification
  240. if: inputs.release_type != 'Actions'
  241. run: |
  242. RELEASE_TYPE_TEXT=""
  243. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  244. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  245. elif [ "${{ inputs.release_type }}" == "Release (No Artifacts)" ]; then
  246. RELEASE_TYPE_TEXT="🚀 *Release*"
  247. else
  248. RELEASE_TYPE_TEXT="🚀 *Release*"
  249. fi
  250. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  251. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  252. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  253. -F text="
  254. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  255. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  256. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  257. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  258. -F parse_mode="Markdown"