main.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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. bbg:
  28. description: "BBG"
  29. required: false
  30. type: boolean
  31. default: true
  32. zeromount:
  33. description: "Zeromount"
  34. required: false
  35. type: boolean
  36. default: false
  37. unicodefix:
  38. description: "Unicode fix"
  39. required: false
  40. type: boolean
  41. default: true
  42. droidspace:
  43. description: "Droidspaces"
  44. required: false
  45. type: boolean
  46. default: true
  47. ntsync:
  48. description: "NTsync"
  49. required: false
  50. type: boolean
  51. default: true
  52. bbrv1:
  53. description: "bbrv1"
  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. ksun: ${{ inputs.ksun }}
  92. droidspace: ${{ inputs.droidspace }}
  93. ntsync: ${{ inputs.ntsync }}
  94. bbrv1: ${{ inputs.bbrv1 }}
  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@v4
  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@v4
  139. with:
  140. path: ./downloaded-artifacts
  141. pattern: '*-AnyKernel3'
  142. - name: get ksun and susfs 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. - name: Set release body
  150. run: |
  151. cat << 'EOF' > release_body.md
  152. **IMPORTANT DISCLAIMER**
  153. This software is provided for testing and educational purposes only. Use at your own risk.
  154. The developers are not responsible for any damage, data loss, or issues that may occur.
  155. Please ensure you have proper backups before installation.
  156. Features:
  157. EOF
  158. if [ "${{ inputs.ksun }}" = "true" ]; then
  159. cat <<'EOF' >> release_body.md
  160. -> KernelSU-Next v3.3.0 - https://github.com/KernelSU-Next/KernelSU-Next
  161. EOF
  162. fi
  163. if [ "${{ inputs.susfs }}" = "true" ]; then
  164. cat <<'EOF' >> release_body.md
  165. -> SUSFS ඞ v2.2.0 - https://gitlab.com/simonpunk/susfs4ksu
  166. -> SUSFS Inline hooks
  167. EOF
  168. fi
  169. if [ "${{ inputs.bbg }}" = "true" ]; then
  170. cat <<'EOF' >> release_body.md
  171. -> BBG - https://github.com/vc-teahouse/Baseband-guard
  172. EOF
  173. fi
  174. if [ "${{ inputs.unicodefix }}" = "true" ]; then
  175. cat <<'EOF' >> release_body.md
  176. -> unicode fix - Prevent path traversal and other detections using non-printable Unicode codepoints
  177. EOF
  178. fi
  179. if [ "${{ inputs.zeromount }}" = "true" ]; then
  180. cat <<'EOF' >> release_body.md
  181. -> Zeromount - https://github.com/Enginex0/zeromount
  182. EOF
  183. fi
  184. if [ "${{ inputs.droidspace }}" = "true" ]; then
  185. cat <<'EOF' >> release_body.md
  186. -> droidspaces support - https://github.com/ravindu644/Droidspaces-OSS
  187. EOF
  188. fi
  189. if [ "${{ inputs.ntsync }}" = "true" ]; then
  190. cat <<'EOF' >> release_body.md
  191. -> NTSync - Provide high-performance, low-latency synchronization primitives compatible with the Windows NT kernel API
  192. EOF
  193. fi
  194. if [ "${{ inputs.bbr }}" = "true" ]; then
  195. cat <<'EOF' >> release_body.md
  196. -> TCP BBRV3 (better TCP congestion and faster internet)
  197. -> CAKE and PIE qdisc Support - Better Net Schedulers
  198. EOF
  199. fi
  200. if [ "${{ inputs.ipv6_nat }}" = "true" ]; then
  201. cat <<'EOF' >> release_body.md
  202. -> IP Set & IPv6 NAT Support - Advanced firewall capabilities and IPv6 NAT Support
  203. EOF
  204. fi
  205. if [ "${{ inputs.ttl }}" = "true" ]; then
  206. cat <<'EOF' >> release_body.md
  207. -> TTL Target Support - Network packet manipulation
  208. EOF
  209. fi
  210. if [ "${{ inputs.optimization }}" = "true" ]; then
  211. cat <<'EOF' >> release_body.md
  212. -> Kernel Optimization - Memory, I/O, CPU scheduler, network and other general tunings
  213. -> Patches for optimizations can be found here - https://github.com/WildKernels/kernel_patches/tree/main/common
  214. EOF
  215. fi
  216. cat <<'EOF' >> release_body.md
  217. Notes:
  218. - Currently no support for KernelPatch-Next/KPM for the time being.
  219. Module:
  220. -> https://github.com/sidex15/ksu_module_susfs
  221. -> https://github.com/rrr333nnn333/BRENE
  222. Commit Hashes:
  223. KSUN: ${{ env.KSUN_HASH }}
  224. SUSFS:
  225. android12-5.10: ${{ env.SUSFS_510 }}
  226. android13-5.15: ${{ env.SUSFS_515 }}
  227. android14-6.1: ${{ env.SUSFS_61 }}
  228. android15-6.6: ${{ env.SUSFS_66 }}
  229. EOF
  230. - name: Create GitHub Release
  231. uses: softprops/action-gh-release@v2
  232. with:
  233. tag_name: ${{ env.NEW_TAG }}
  234. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  235. files: ""
  236. name: ${{ env.RELEASE_NAME }}
  237. body_path: release_body.md
  238. - name: Upload Release Assets
  239. run: |
  240. shopt -s nullglob
  241. anykernel_dirs=(./downloaded-artifacts/*/)
  242. if [ ${#anykernel_dirs[@]} -eq 0 ]; then
  243. echo "No artifact directories found under ./downloaded-artifacts; skipping upload."
  244. else
  245. for dir in "${anykernel_dirs[@]}"; do
  246. # Check if this is an AnyKernel3 artifact directory
  247. if [[ "$(basename "$dir")" == *"-AnyKernel3" ]]; then
  248. artifact_name=$(basename "$dir")
  249. echo "Creating ZIP for $artifact_name..."
  250. # Navigate into the directory and zip its contents directly
  251. cd "$dir"
  252. zip -r -9 "../../${artifact_name}.zip" ./*
  253. cd - > /dev/null
  254. echo "Uploading ${artifact_name}.zip..."
  255. gh release upload ${{ env.NEW_TAG }} "${artifact_name}.zip"
  256. fi
  257. done
  258. fi
  259. # - name: Send Telegram Notification
  260. # if: inputs.release_type != 'Actions'
  261. # run: |
  262. # RELEASE_TYPE_TEXT=""
  263. # if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  264. # RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  265. # else
  266. # RELEASE_TYPE_TEXT="🚀 *Release*"
  267. # fi
  268. #
  269. # curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  270. # -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  271. # -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  272. # -F text="
  273. # 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  274. # 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  275. # ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  276. # [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  277. # -F parse_mode="Markdown"