main.yml 12 KB

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