main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. name: Build Kernels
  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. ksun:
  18. description: "KSUN"
  19. required: false
  20. default: true
  21. type: boolean
  22. susfs:
  23. description: "SUSFS"
  24. required: false
  25. type: boolean
  26. default: true
  27. zeromount:
  28. description: "Zeromount"
  29. required: false
  30. type: boolean
  31. default: false
  32. nomount:
  33. description: "NoMount"
  34. required: false
  35. type: boolean
  36. default: false
  37. bbg:
  38. description: "BBG"
  39. required: false
  40. type: boolean
  41. default: true
  42. unicodefix:
  43. description: "Unicode fix"
  44. required: false
  45. type: boolean
  46. default: true
  47. droidspace:
  48. description: "Droidspaces"
  49. required: false
  50. type: boolean
  51. default: true
  52. ntsync:
  53. description: "NTsync"
  54. required: false
  55. type: boolean
  56. default: true
  57. bbrv3:
  58. description: "bbrv3"
  59. required: false
  60. type: boolean
  61. default: true
  62. cache:
  63. description: "CCache"
  64. required: false
  65. default: true
  66. type: boolean
  67. ipv6_nat:
  68. description: "IPv6_NAT & IP-SET"
  69. required: false
  70. default: true
  71. type: boolean
  72. optimization:
  73. description: "optimization patches"
  74. required: false
  75. default: true
  76. type: boolean
  77. ttl:
  78. description: "TTL support"
  79. required: false
  80. default: true
  81. type: boolean
  82. jobs:
  83. build-samsung:
  84. uses: ./.github/workflows/kernel-samsung.yml
  85. secrets: inherit
  86. with:
  87. susfs: ${{ inputs.susfs }}
  88. bbg: ${{ inputs.bbg }}
  89. unicodefix: ${{ inputs.unicodefix }}
  90. zeromount: ${{ inputs.zeromount }}
  91. nomount: ${{ inputs.nomount }}
  92. ksun: ${{ inputs.ksun }}
  93. droidspace: ${{ inputs.droidspace }}
  94. ntsync: ${{ inputs.ntsync }}
  95. bbrv3: ${{ inputs.bbrv3 }}
  96. cache: ${{ inputs.cache }}
  97. ipv6_nat: ${{ inputs.ipv6_nat }}
  98. optimization: ${{ inputs.optimization }}
  99. ttl: ${{ inputs.ttl }}
  100. release:
  101. runs-on: ubuntu-latest
  102. if: inputs.release_type != 'Actions'
  103. needs:
  104. - build-samsung
  105. env:
  106. GH_TOKEN: ${{ github.token }}
  107. RELEASE_NAME: "Samsung GKI Kernels With KSUN v3.3.0 & SUSFS v2.2.0"
  108. RELEASE_BODY: ""
  109. steps:
  110. - name: Free Disk Space
  111. if: true
  112. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  113. with:
  114. remove_android: true
  115. remove_dotnet: true
  116. remove_haskell: true
  117. remove_tool_cache: true
  118. remove_swap: true
  119. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  120. remove_packages_one_command: true
  121. remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
  122. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  123. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  124. testing: false
  125. - name: Checkout code
  126. uses: actions/checkout@v7
  127. - name: Generate New Tag
  128. if: inputs.release_type != 'Actions'
  129. run: |
  130. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  131. if [ -z "$LATEST_TAG" ]; then
  132. LATEST_TAG="v2.2.0-r0"
  133. fi
  134. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  135. echo "New tag: $NEW_TAG"
  136. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  137. - name: Download Artifacts
  138. uses: actions/download-artifact@v8
  139. with:
  140. path: ./downloaded-artifacts
  141. pattern: '*-AnyKernel3'
  142. - name: get commit hashes
  143. run: |
  144. echo "SUSFS_510=$(git ls-remote https://gitlab.com/simonpunk/susfs4ksu.git refs/heads/gki-android12-5.10 | cut -f1)" >> $GITHUB_ENV
  145. echo "SUSFS_515=$(git ls-remote https://gitlab.com/simonpunk/susfs4ksu.git refs/heads/gki-android13-5.15 | cut -f1)" >> $GITHUB_ENV
  146. echo "SUSFS_61=$(git ls-remote https://gitlab.com/simonpunk/susfs4ksu.git refs/heads/gki-android14-6.1 | cut -f1)" >> $GITHUB_ENV
  147. echo "SUSFS_66=$(git ls-remote https://gitlab.com/simonpunk/susfs4ksu.git refs/heads/gki-android15-6.6 | cut -f1)" >> $GITHUB_ENV
  148. echo "KSUN_HASH=$(git ls-remote https://github.com/pershoot/KernelSU-Next.git refs/heads/dev | cut -f1)" >> $GITHUB_ENV
  149. echo "BBG_HASH=$(git ls-remote https://github.com/vc-teahouse/Baseband-guard.git refs/heads/main | cut -f1)" >> $GITHUB_ENV
  150. echo "NM_HASH=$(git ls-remote https://github.com/maxsteeel/nomount.git refs/heads/master | cut -f1)" >> $GITHUB_ENV
  151. - name: Set release body
  152. run: |
  153. cat << 'EOF' > release_body.md
  154. **IMPORTANT DISCLAIMER**
  155. This software is provided for testing and educational purposes only. Use at your own risk.
  156. The developers are not responsible for any damage, data loss, or issues that may occur.
  157. Please ensure you have proper backups before installation.
  158. Features:
  159. EOF
  160. if [ "${{ inputs.ksun }}" = "true" ]; then
  161. cat <<'EOF' >> release_body.md
  162. -> KernelSU-Next v3.3.0 - https://github.com/KernelSU-Next/KernelSU-Next
  163. EOF
  164. fi
  165. if [ "${{ inputs.susfs }}" = "true" ]; then
  166. cat <<'EOF' >> release_body.md
  167. -> SUSFS ඞ v2.2.0 - https://gitlab.com/simonpunk/susfs4ksu
  168. -> SUSFS Inline hooks
  169. EOF
  170. fi
  171. if [ "${{ inputs.bbg }}" = "true" ]; then
  172. cat <<'EOF' >> release_body.md
  173. -> BBG - https://github.com/vc-teahouse/Baseband-guard
  174. EOF
  175. fi
  176. if [ "${{ inputs.unicodefix }}" = "true" ]; then
  177. cat <<'EOF' >> release_body.md
  178. -> unicode fix - Prevent path traversal and other detections using non-printable Unicode codepoints
  179. EOF
  180. fi
  181. if [ "${{ inputs.zeromount }}" = "true" ]; then
  182. cat <<'EOF' >> release_body.md
  183. -> Zeromount - https://github.com/Enginex0/zeromount
  184. EOF
  185. fi
  186. if [ "${{ inputs.nomount }}" = "true" ]; then
  187. cat <<'EOF' >> release_body.md
  188. -> NoMount - https://github.com/maxsteeel/nomount
  189. EOF
  190. fi
  191. if [ "${{ inputs.droidspace }}" = "true" ]; then
  192. cat <<'EOF' >> release_body.md
  193. -> droidspaces support - https://github.com/ravindu644/Droidspaces-OSS
  194. EOF
  195. fi
  196. if [ "${{ inputs.ntsync }}" = "true" ]; then
  197. cat <<'EOF' >> release_body.md
  198. -> NTSync - Provide high-performance, low-latency synchronization primitives compatible with the Windows NT kernel API
  199. EOF
  200. fi
  201. if [ "${{ inputs.bbrv3 }}" = "true" ]; then
  202. cat <<'EOF' >> release_body.md
  203. -> TCP BBRV3 (better TCP congestion and faster internet)
  204. -> CAKE and PIE qdisc Support - Better Net Schedulers
  205. EOF
  206. fi
  207. if [ "${{ inputs.ipv6_nat }}" = "true" ]; then
  208. cat <<'EOF' >> release_body.md
  209. -> IP Set & IPv6 NAT Support - Advanced firewall capabilities and IPv6 NAT Support
  210. EOF
  211. fi
  212. if [ "${{ inputs.ttl }}" = "true" ]; then
  213. cat <<'EOF' >> release_body.md
  214. -> TTL Target Support - Network packet manipulation
  215. EOF
  216. fi
  217. if [ "${{ inputs.optimization }}" = "true" ]; then
  218. cat <<'EOF' >> release_body.md
  219. -> Kernel Optimization - Memory, I/O, CPU scheduler, network and other general tunings
  220. -> Patches for optimizations can be found here - https://github.com/WildKernels/kernel_patches/tree/main/common
  221. EOF
  222. fi
  223. cat <<'EOF' >> release_body.md
  224. Notes:
  225. - Currently no support for KernelPatch-Next/KPM for the time being.
  226. Module:
  227. -> https://github.com/sidex15/ksu_module_susfs
  228. -> https://github.com/rrr333nnn333/BRENE
  229. Commit Hashes:
  230. EOF
  231. if ${{ inputs.ksun }} == 'true' ]]; then
  232. cat <<'EOF' >> release_body.md
  233. KSUN: ${{ env.KSUN_HASH }}
  234. EOF
  235. fi
  236. if ${{ inputs.susfs }} == 'true' ]]; then
  237. cat <<'EOF' >> release_body.md
  238. SUSFS:
  239. android12-5.10: ${{ env.SUSFS_510 }}
  240. android13-5.15: ${{ env.SUSFS_515 }}
  241. android14-6.1: ${{ env.SUSFS_61 }}
  242. android15-6.6: ${{ env.SUSFS_66 }}
  243. EOF
  244. fi
  245. if ${{ inputs.bbg }} == 'true' ]]; then
  246. cat <<'EOF' >> release_body.md
  247. BBG: ${{ env.BBG_HASH }}
  248. EOF
  249. fi
  250. if ${{ inputs.nomount }} == 'true' ]]; then
  251. cat <<'EOF' >> release_body.md
  252. NoMount: ${{ env.NM_HASH }}
  253. EOF
  254. fi
  255. - name: Create GitHub Release
  256. uses: softprops/action-gh-release@v3
  257. with:
  258. tag_name: ${{ env.NEW_TAG }}
  259. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  260. files: ""
  261. name: ${{ env.RELEASE_NAME }}
  262. body_path: release_body.md
  263. - name: Upload Release Assets
  264. run: |
  265. shopt -s nullglob
  266. anykernel_dirs=(./downloaded-artifacts/*/)
  267. if [ ${#anykernel_dirs[@]} -eq 0 ]; then
  268. echo "No artifact directories found under ./downloaded-artifacts; skipping upload."
  269. else
  270. for dir in "${anykernel_dirs[@]}"; do
  271. # Check if this is an AnyKernel3 artifact directory
  272. if [[ "$(basename "$dir")" == *"-AnyKernel3" ]]; then
  273. artifact_name=$(basename "$dir")
  274. echo "Creating ZIP for $artifact_name..."
  275. # Navigate into the directory and zip its contents directly
  276. cd "$dir"
  277. zip -r -9 "../../${artifact_name}.zip" ./*
  278. cd - > /dev/null
  279. echo "Uploading ${artifact_name}.zip..."
  280. gh release upload ${{ env.NEW_TAG }} "${artifact_name}.zip"
  281. fi
  282. done
  283. fi
  284. # - name: Send Telegram Notification
  285. # if: inputs.release_type != 'Actions'
  286. # run: |
  287. # RELEASE_TYPE_TEXT=""
  288. # if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  289. # RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  290. # else
  291. # RELEASE_TYPE_TEXT="🚀 *Release*"
  292. # fi
  293. #
  294. # curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  295. # -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  296. # -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  297. # -F text="
  298. # 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  299. # 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  300. # ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  301. # [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  302. # -F parse_mode="Markdown"