main.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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 "NEXT" "https://github.com/KernelSU-Next/KernelSU-Next.git" "KernelSU-Next/KernelSU-Next" "$MODE"
  180. - name: Generate and Create New Tag
  181. run: |
  182. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name')
  183. if [ -z "$LATEST_TAG" ]; then
  184. LATEST_TAG="v1.5.9-r0"
  185. fi
  186. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  187. echo "New tag: $NEW_TAG"
  188. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  189. git tag $NEW_TAG
  190. git push origin $NEW_TAG
  191. - name: Download Artifacts
  192. uses: actions/download-artifact@v4
  193. with:
  194. path: ./downloaded-artifacts
  195. - name: Set release body
  196. run: |
  197. cat << 'EOF' > release_body.md
  198. Branch type for KSU: ${{ inputs.kernelsu_branch }}
  199. Wild Current Kernel Tag: ${{ env.NEW_TAG }}
  200. Features:
  201. -> SUSFS ඞ v1.5.9
  202. -> Scope-Minimized Manual hooks v1.4
  203. -> Magic Mount Support
  204. -> Simple Maphide for LineageOS Detections
  205. -> Futile Maphide for jit-zygote-cache Detections
  206. -> Wireguard Support
  207. -> BBR v1 Support
  208. Notes:
  209. -> SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  210. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/
  211. Module:
  212. -> https://github.com/sidex15/ksu_module_susfs
  213. Managers:
  214. -> KernelSU-Next: https://github.com/KernelSU-Next/KernelSU-Next
  215. Commit Hashes (at the time of release):
  216. -> Wild KSU: [${{ env.WILD_REF }}](${{ env.WILD_URL }})
  217. -> KernelSU Next: [${{ env.NEXT_REF }}](${{ env.NEXT_URL }})
  218. -> SUSFS4KSU:
  219. -> gki-android12-5.10: [${{ env.COMMIT_HASH_gki_android12_5_10 }}](${{ env.COMMIT_URL_gki_android12_5_10 }})
  220. -> gki-android13-5.10: [${{ env.COMMIT_HASH_gki_android13_5_10 }}](${{ env.COMMIT_URL_gki_android13_5_10 }})
  221. -> gki-android13-5.15: [${{ env.COMMIT_HASH_gki_android13_5_15 }}](${{ env.COMMIT_URL_gki_android13_5_15 }})
  222. -> gki-android14-5.15: [${{ env.COMMIT_HASH_gki_android14_5_15 }}](${{ env.COMMIT_URL_gki_android14_5_15 }})
  223. -> gki-android14-6.1: [${{ env.COMMIT_HASH_gki_android14_6_1 }}](${{ env.COMMIT_URL_gki_android14_6_1 }})
  224. -> gki-android15-6.6: [${{ env.COMMIT_HASH_gki_android15_6_6 }}](${{ env.COMMIT_URL_gki_android15_6_6 }})
  225. EOF
  226. - name: Create GitHub Release
  227. uses: softprops/action-gh-release@v2
  228. with:
  229. tag_name: ${{ env.NEW_TAG }}
  230. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  231. files: ""
  232. name: ${{ env.RELEASE_NAME }}
  233. body_path: release_body.md
  234. - name: Upload Release Assets
  235. run: |
  236. for file in ./downloaded-artifacts/*-kernel-*/*; do
  237. if [ -d "$file" ]; then
  238. continue
  239. fi
  240. echo "Uploading $file..."
  241. gh release upload ${{ env.NEW_TAG }} "$file"
  242. done
  243. - name: Display Files Uploaded
  244. run: |
  245. echo "GitHub release created with the following files:"
  246. ls ./downloaded-artifacts/**/*
  247. - name: Send Telegram Notification
  248. run: |
  249. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  250. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  251. -F message_thread_id="${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}" \
  252. -F text="
  253. 🌽 *New Kernel Release Uploaded*
  254. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  255. 🗂️ *Branch:* ${{ github.ref_name }}
  256. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  257. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  258. -F parse_mode="Markdown"