main.yml 13 KB

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