main.yml 9.9 KB

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