main.yml 12 KB

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