main.yml 11 KB

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