main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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: Pre-Release
  17. include_wild:
  18. description: 'Include WILD?'
  19. required: true
  20. type: boolean
  21. default: false
  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: true
  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: Dev
  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 Notification
  56. run: |
  57. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  58. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  59. -F message_thread_id="${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}" \
  60. -F text="
  61. 🚀 Build started for Kernel!
  62. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  63. 🗂️ *Branch:* ${{ github.ref_name }}
  64. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  65. [🔗 View GitHub Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" \
  66. -F parse_mode="Markdown"
  67. set-matrix:
  68. runs-on: ubuntu-latest
  69. timeout-minutes: 120
  70. outputs:
  71. matrix: ${{ steps.set-matrix.outputs.matrix }}
  72. steps:
  73. - id: set-matrix
  74. run: |
  75. VARIANTS=()
  76. [[ "${{ inputs.include_wild }}" == "true" ]] && VARIANTS+=("\"WILD\"")
  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 WildKSU & SUSFS v1.5.9"
  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 "WILD" "https://github.com/WildKernels/Wild_KSU.git" "WildKernels/Wild_KSU" "$MODE"
  180. get_ref "KSU" "https://github.com/tiann/KernelSU.git" "tiann/KernelSU" "$MODE"
  181. get_ref "NEXT" "https://github.com/KernelSU-Next/KernelSU-Next.git" "KernelSU-Next/KernelSU-Next" "$MODE"
  182. get_ref "MKSU" "https://github.com/5ec1cff/KernelSU.git" "5ec1cff/KernelSU" "commit"
  183. - name: Generate and Create New Tag
  184. run: |
  185. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name')
  186. if [ -z "$LATEST_TAG" ]; then
  187. LATEST_TAG="v1.5.9-r0"
  188. fi
  189. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  190. echo "New tag: $NEW_TAG"
  191. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  192. git tag $NEW_TAG
  193. git push origin $NEW_TAG
  194. - name: Download Artifacts
  195. uses: actions/download-artifact@v4
  196. with:
  197. path: ./downloaded-artifacts
  198. - name: Set release body
  199. run: |
  200. cat << 'EOF' > release_body.md
  201. Branch type for KSU: ${{ inputs.kernelsu_branch }}
  202. Wild Current Kernel Tag: ${{ env.NEW_TAG }}
  203. Features:
  204. -> Wild KSU Kernels & Others
  205. -> Multi Manager Support for Wild Kernels & Next Kernels (Not Recommended)
  206. -> SUSFS ඞ v1.5.9
  207. -> Scope-Minimized Manual hooks v1.4
  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. -> 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!
  215. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/ or https://github.com/libxzr/HorizonKernelFlasher!
  216. Module:
  217. -> https://github.com/sidex15/ksu_module_susfs
  218. Managers:
  219. -> Wild KSU: https://github.com/WildKernels/Wild_KSU / https://t.me/WildKernels
  220. -> KernelSU: https://github.com/tiann/KernelSU / https://t.me/KernelSU_group
  221. -> 5ec1cff's KernelSU: https://github.com/5ec1cff/KernelSU / https://t.me/mksu_ci
  222. -> KernelSU-Next: https://github.com/rifsxd/KernelSU-Next / https://t.me/ksunext_group
  223. -> rsuntk: https://github.com/rsuntk/KernelSU / https://t.me/rsukrnlsu
  224. -> backslashxx: https://github.com/backslashxx/KernelSU
  225. Commit Hashes (at the time of release):
  226. -> Wild KSU: [${{ env.WILD_REF }}](${{ env.WILD_URL }})
  227. -> KernelSU: [${{ env.KSU_REF }}](${{ env.KSU_URL }})
  228. -> 5ec1cff: [${{ env.MKSU_REF }}](${{ env.MKSU_URL }})
  229. -> KernelSU Next: [${{ env.NEXT_REF }}](${{ env.NEXT_URL }})
  230. -> SUSFS4KSU:
  231. -> gki-android12-5.10: [${{ env.COMMIT_HASH_gki_android12_5_10 }}](${{ env.COMMIT_URL_gki_android12_5_10 }})
  232. -> gki-android13-5.10: [${{ env.COMMIT_HASH_gki_android13_5_10 }}](${{ env.COMMIT_URL_gki_android13_5_10 }})
  233. -> gki-android13-5.15: [${{ env.COMMIT_HASH_gki_android13_5_15 }}](${{ env.COMMIT_URL_gki_android13_5_15 }})
  234. -> gki-android14-5.15: [${{ env.COMMIT_HASH_gki_android14_5_15 }}](${{ env.COMMIT_URL_gki_android14_5_15 }})
  235. -> gki-android14-6.1: [${{ env.COMMIT_HASH_gki_android14_6_1 }}](${{ env.COMMIT_URL_gki_android14_6_1 }})
  236. -> gki-android15-6.6: [${{ env.COMMIT_HASH_gki_android15_6_6 }}](${{ env.COMMIT_URL_gki_android15_6_6 }})
  237. EOF
  238. - name: Create GitHub Release
  239. uses: softprops/action-gh-release@v2
  240. with:
  241. tag_name: ${{ env.NEW_TAG }}
  242. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  243. files: ""
  244. name: ${{ env.RELEASE_NAME }}
  245. body_path: release_body.md
  246. - name: Upload Release Assets
  247. run: |
  248. for file in ./downloaded-artifacts/*-kernel-*/*; do
  249. if [ -d "$file" ]; then
  250. continue
  251. fi
  252. echo "Uploading $file..."
  253. gh release upload ${{ env.NEW_TAG }} "$file"
  254. done
  255. - name: Display Files Uploaded
  256. run: |
  257. echo "GitHub release created with the following files:"
  258. ls ./downloaded-artifacts/**/*
  259. - name: Send Telegram Notification
  260. run: |
  261. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  262. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  263. -F message_thread_id="${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}" \
  264. -F text="
  265. 🌽 *New Stable Kernel Release Uploaded*
  266. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  267. 🗂️ *Branch:* ${{ github.ref_name }}
  268. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  269. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  270. -F parse_mode="Markdown"