main.yml 12 KB

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