main.yml 11 KB

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