main.yml 11 KB

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