main.yml 10 KB

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