main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. name: Build GKI
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. use_make:
  9. description: 'Build with MAKE?'
  10. required: true
  11. type: boolean
  12. default: true
  13. release_type:
  14. description: "Choose Release Type"
  15. required: true
  16. type: choice
  17. options:
  18. - Actions
  19. - Pre-Release
  20. - Release
  21. default: Pre-Release
  22. include_wild:
  23. description: 'Include WILD?'
  24. required: true
  25. type: boolean
  26. default: false
  27. include_ksu:
  28. description: 'Include KSU?'
  29. required: true
  30. type: boolean
  31. default: false
  32. include_next:
  33. description: 'Include NEXT?'
  34. required: true
  35. type: boolean
  36. default: true
  37. include_mksu:
  38. description: 'Include MKSU?'
  39. required: true
  40. type: boolean
  41. default: false
  42. kernelsu_branch:
  43. description: "Choose ksu branch"
  44. required: true
  45. type: choice
  46. options:
  47. - Stable
  48. - Dev
  49. - Other
  50. default: Dev
  51. kernelsu_branch_other:
  52. description: "If 'Other' is selected, specify your custom branch"
  53. required: false
  54. type: string
  55. default: ""
  56. jobs:
  57. notify:
  58. runs-on: ubuntu-latest
  59. steps:
  60. - name: Send Telegram Notification
  61. run: |
  62. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  63. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  64. -F message_thread_id="${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}" \
  65. -F text="
  66. 🚀 Build started for Kernel!
  67. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  68. 🗂️ *Branch:* ${{ github.ref_name }}
  69. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  70. [🔗 View GitHub Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" \
  71. -F parse_mode="Markdown"
  72. set-matrix:
  73. runs-on: ubuntu-latest
  74. timeout-minutes: 120
  75. outputs:
  76. matrix: ${{ steps.set-matrix.outputs.matrix }}
  77. steps:
  78. - id: set-matrix
  79. run: |
  80. VARIANTS=()
  81. [[ "${{ inputs.include_wild }}" == "true" ]] && VARIANTS+=("\"WILD\"")
  82. [[ "${{ inputs.include_ksu }}" == "true" ]] && VARIANTS+=("\"KSU\"")
  83. [[ "${{ inputs.include_next }}" == "true" ]] && VARIANTS+=("\"NEXT\"")
  84. [[ "${{ inputs.include_mksu }}" == "true" ]] && VARIANTS+=("\"MKSU\"")
  85. echo "matrix={\"kernelsu_variant\": [$(IFS=,; echo "${VARIANTS[*]}")]}" >> $GITHUB_OUTPUT
  86. build-kernels-a12:
  87. needs: set-matrix
  88. uses: ./.github/workflows/kernel-a12.yml
  89. secrets: inherit
  90. strategy:
  91. fail-fast: true
  92. matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
  93. with:
  94. kernelsu_variant: ${{ matrix.kernelsu_variant }}
  95. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  96. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  97. use_make: ${{ inputs.use_make }}
  98. build-kernels-a13:
  99. needs: set-matrix
  100. uses: ./.github/workflows/kernel-a13.yml
  101. secrets: inherit
  102. strategy:
  103. fail-fast: true
  104. matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
  105. with:
  106. kernelsu_variant: ${{ matrix.kernelsu_variant }}
  107. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  108. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  109. use_make: ${{ inputs.use_make }}
  110. build-kernels-a14:
  111. needs: set-matrix
  112. uses: ./.github/workflows/kernel-a14.yml
  113. secrets: inherit
  114. strategy:
  115. fail-fast: true
  116. matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
  117. with:
  118. kernelsu_variant: ${{ matrix.kernelsu_variant }}
  119. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  120. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  121. use_make: ${{ inputs.use_make }}
  122. build-kernels-a15:
  123. needs: set-matrix
  124. uses: ./.github/workflows/kernel-a15.yml
  125. secrets: inherit
  126. strategy:
  127. fail-fast: true
  128. matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
  129. with:
  130. kernelsu_variant: ${{ matrix.kernelsu_variant }}
  131. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  132. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  133. use_make: ${{ inputs.use_make }}
  134. release:
  135. if: ${{ inputs.release_type == 'Release' || inputs.release_type == 'Pre-Release' }}
  136. runs-on: ubuntu-latest
  137. needs:
  138. - build-kernels-a12
  139. - build-kernels-a13
  140. - build-kernels-a14
  141. - build-kernels-a15
  142. env:
  143. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  144. RELEASE_NAME: "GKI Kernels With WildKSU & SUSFS v1.5.9"
  145. RELEASE_BODY:
  146. steps:
  147. - name: Checkout code
  148. uses: actions/checkout@v4
  149. - name: Get commit hashes and generate commit URLs
  150. run: |
  151. GITLAB_OWNER="simonpunk"
  152. GITLAB_REPO="susfs4ksu"
  153. declare -A BRANCH_MAP=(
  154. ["gki_android12_5_10"]="gki-android12-5.10"
  155. ["gki_android13_5_10"]="gki-android13-5.10"
  156. ["gki_android13_5_15"]="gki-android13-5.15"
  157. ["gki_android14_5_15"]="gki-android14-5.15"
  158. ["gki_android14_6_1"]="gki-android14-6.1"
  159. ["gki_android15_6_6"]="gki-android15-6.6"
  160. )
  161. for var_name in "${!BRANCH_MAP[@]}"; do
  162. branch_name="${BRANCH_MAP[$var_name]}"
  163. COMMIT_HASH=$(git ls-remote https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO.git refs/heads/$branch_name | awk '{ print $1 }')
  164. if [[ -n "$COMMIT_HASH" ]]; then
  165. COMMIT_URL="https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO/-/commit/$COMMIT_HASH"
  166. echo "$branch_name Commit: $COMMIT_HASH"
  167. echo "$branch_name Commit URL: $COMMIT_URL"
  168. echo "COMMIT_HASH_${var_name}=$COMMIT_HASH" >> "$GITHUB_ENV"
  169. echo "COMMIT_URL_${var_name}=$COMMIT_URL" >> "$GITHUB_ENV"
  170. fi
  171. done
  172. - name: Get KernelSU variant refs and links
  173. run: |
  174. BRANCH="${{ inputs.kernelsu_branch }}"
  175. get_ref() {
  176. local name="$1" repo="$2" path="$3" mode="$4"
  177. if [[ "$mode" == "tag" ]]; then
  178. ref=$(git ls-remote --tags --sort=-v:refname "$repo" | grep -o 'refs/tags/.*' | cut -d/ -f3 | head -n1)
  179. url="https://github.com/$path/releases/tag/$ref"
  180. else
  181. ref=$(git ls-remote "$repo" HEAD | awk '{print $1}')
  182. url="https://github.com/$path/commit/$ref"
  183. fi
  184. echo "${name}_REF=$ref" >> $GITHUB_ENV
  185. echo "${name}_URL=$url" >> $GITHUB_ENV
  186. }
  187. [[ "$BRANCH" == "Stable" ]] && MODE="tag" || MODE="commit"
  188. get_ref "WILD" "https://github.com/WildKernels/Wild_KSU.git" "WildKernels/Wild_KSU" "$MODE"
  189. get_ref "KSU" "https://github.com/tiann/KernelSU.git" "tiann/KernelSU" "$MODE"
  190. get_ref "NEXT" "https://github.com/KernelSU-Next/KernelSU-Next.git" "KernelSU-Next/KernelSU-Next" "$MODE"
  191. get_ref "MKSU" "https://github.com/5ec1cff/KernelSU.git" "5ec1cff/KernelSU" "commit"
  192. - name: Generate and Create New Tag
  193. run: |
  194. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name')
  195. if [ -z "$LATEST_TAG" ]; then
  196. LATEST_TAG="v1.5.9-r0"
  197. fi
  198. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  199. echo "New tag: $NEW_TAG"
  200. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  201. git tag $NEW_TAG
  202. git push origin $NEW_TAG
  203. - name: Download Artifacts
  204. uses: actions/download-artifact@v4
  205. with:
  206. path: ./downloaded-artifacts
  207. - name: Set release body
  208. run: |
  209. cat << 'EOF' > release_body.md
  210. Branch type for KSU: ${{ inputs.kernelsu_branch }}
  211. Wild Current Kernel Tag: ${{ env.NEW_TAG }}
  212. Features:
  213. -> Wild KSU Kernels & Others
  214. -> Multi Manager Support for Wild Kernels & Next Kernels (Not Recommended)
  215. -> SUSFS ඞ v1.5.9
  216. -> Scope-Minimized Manual hooks v1.4
  217. -> Magic Mount Support
  218. -> Simple Maphide for LineageOS Detections
  219. -> Futile Maphide for jit-zygote-cache Detections
  220. -> Wireguard Support
  221. -> BBR Support
  222. Notes:
  223. -> Wild KSU & KernelSU-Next, SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  224. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/ or https://github.com/libxzr/HorizonKernelFlasher!
  225. Module:
  226. -> https://github.com/sidex15/ksu_module_susfs
  227. Managers:
  228. -> Wild KSU: https://github.com/WildKernels/Wild_KSU / https://t.me/WildKernels
  229. -> KernelSU: https://github.com/tiann/KernelSU / https://t.me/KernelSU_group
  230. -> 5ec1cff's KernelSU: https://github.com/5ec1cff/KernelSU / https://t.me/mksu_ci
  231. -> KernelSU-Next: https://github.com/rifsxd/KernelSU-Next / https://t.me/ksunext_group
  232. -> rsuntk: https://github.com/rsuntk/KernelSU / https://t.me/rsukrnlsu
  233. -> backslashxx: https://github.com/backslashxx/KernelSU
  234. Commit Hashes (at the time of release):
  235. -> Wild KSU: [${{ env.WILD_REF }}](${{ env.WILD_URL }})
  236. -> KernelSU: [${{ env.KSU_REF }}](${{ env.KSU_URL }})
  237. -> 5ec1cff: [${{ env.MKSU_REF }}](${{ env.MKSU_URL }})
  238. -> KernelSU Next: [${{ env.NEXT_REF }}](${{ env.NEXT_URL }})
  239. -> SUSFS4KSU:
  240. -> gki-android12-5.10: [${{ env.COMMIT_HASH_gki_android12_5_10 }}](${{ env.COMMIT_URL_gki_android12_5_10 }})
  241. -> gki-android13-5.10: [${{ env.COMMIT_HASH_gki_android13_5_10 }}](${{ env.COMMIT_URL_gki_android13_5_10 }})
  242. -> gki-android13-5.15: [${{ env.COMMIT_HASH_gki_android13_5_15 }}](${{ env.COMMIT_URL_gki_android13_5_15 }})
  243. -> gki-android14-5.15: [${{ env.COMMIT_HASH_gki_android14_5_15 }}](${{ env.COMMIT_URL_gki_android14_5_15 }})
  244. -> gki-android14-6.1: [${{ env.COMMIT_HASH_gki_android14_6_1 }}](${{ env.COMMIT_URL_gki_android14_6_1 }})
  245. -> gki-android15-6.6: [${{ env.COMMIT_HASH_gki_android15_6_6 }}](${{ env.COMMIT_URL_gki_android15_6_6 }})
  246. EOF
  247. - name: Create GitHub Release
  248. uses: softprops/action-gh-release@v2
  249. with:
  250. tag_name: ${{ env.NEW_TAG }}
  251. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  252. files: ""
  253. name: ${{ env.RELEASE_NAME }}
  254. body_path: release_body.md
  255. - name: Upload Release Assets
  256. run: |
  257. for file in ./downloaded-artifacts/*-kernel-*/*; do
  258. if [ -d "$file" ]; then
  259. continue
  260. fi
  261. echo "Uploading $file..."
  262. gh release upload ${{ env.NEW_TAG }} "$file"
  263. done
  264. - name: Display Files Uploaded
  265. run: |
  266. echo "GitHub release created with the following files:"
  267. ls ./downloaded-artifacts/**/*
  268. - name: Send Telegram Notification
  269. run: |
  270. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  271. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  272. -F message_thread_id="${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}" \
  273. -F text="
  274. 🌽 *New Kernel Release Uploaded*
  275. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  276. 🗂️ *Branch:* ${{ github.ref_name }}
  277. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  278. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  279. -F parse_mode="Markdown"