main.yml 9.2 KB

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