main.yml 12 KB

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