main.yml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. bbr:
  53. description: "bbrv3"
  54. required: false
  55. type: boolean
  56. default: true
  57. cache:
  58. description: "CCache"
  59. required: false
  60. default: true
  61. type: boolean
  62. ipv6_nat:
  63. description: "IPv6_NAT & IP-SET"
  64. required: false
  65. default: false
  66. type: boolean
  67. optimization:
  68. description: "optimization patches"
  69. required: false
  70. default: false
  71. type: boolean
  72. jobs:
  73. build-samsung:
  74. uses: ./.github/workflows/kernel-samsung.yml
  75. secrets: inherit
  76. with:
  77. susfs: ${{ inputs.susfs }}
  78. bbg: ${{ inputs.bbg }}
  79. unicodefix: ${{ inputs.unicodefix }}
  80. zeromount: ${{ inputs.zeromount }}
  81. ksun: ${{ inputs.ksun }}
  82. droidspace: ${{ inputs.droidspace }}
  83. ntsync: ${{ inputs.ntsync }}
  84. bbr: ${{ inputs.bbr }}
  85. cache: ${{ inputs.cache }}
  86. ipv6_nat: ${{ inputs.ipv6_nat }}
  87. optimization: ${{ inputs.optimization }}
  88. release:
  89. runs-on: ubuntu-latest
  90. if: inputs.release_type != 'Actions'
  91. needs:
  92. - build-samsung
  93. env:
  94. GH_TOKEN: ${{ github.token }}
  95. RELEASE_NAME: "Samsung GKI Kernels With KSUN v3.2.0 & SUSFS v2.2.0"
  96. RELEASE_BODY: ""
  97. steps:
  98. - name: Free Disk Space
  99. if: true
  100. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  101. with:
  102. remove_android: true
  103. remove_dotnet: true
  104. remove_haskell: true
  105. remove_tool_cache: true
  106. remove_swap: true
  107. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  108. remove_packages_one_command: true
  109. 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"
  110. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  111. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  112. testing: false
  113. - name: Checkout code
  114. uses: actions/checkout@v4
  115. - name: Generate New Tag
  116. if: inputs.release_type != 'Actions'
  117. run: |
  118. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  119. if [ -z "$LATEST_TAG" ]; then
  120. LATEST_TAG="v2.2.0-r0"
  121. fi
  122. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  123. echo "New tag: $NEW_TAG"
  124. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  125. - name: Download Artifacts
  126. uses: actions/download-artifact@v4
  127. with:
  128. path: ./downloaded-artifacts
  129. pattern: '*-AnyKernel3'
  130. - name: Set release body
  131. run: |
  132. cat << 'EOF' > release_body.md
  133. **IMPORTANT DISCLAIMER**
  134. This software is provided for testing and educational purposes only. Use at your own risk.
  135. The developers are not responsible for any damage, data loss, or issues that may occur.
  136. Please ensure you have proper backups before installation.
  137. Features:
  138. EOF
  139. if [ "${{ inputs.ksun }}" = "true" ]; then
  140. cat <<'EOF' >> release_body.md
  141. -> KernelSU-Next v3.2.0
  142. EOF
  143. fi
  144. if [ "${{ inputs.susfs }}" = "true" ]; then
  145. cat <<'EOF' >> release_body.md
  146. -> SUSFS ඞ v2.2.0
  147. -> SUSFS Inline hooks
  148. EOF
  149. fi
  150. if [ "${{ inputs.bbg }}" = "true" ]; then
  151. cat <<'EOF' >> release_body.md
  152. -> BBG: https://github.com/vc-teahouse/Baseband-guard
  153. EOF
  154. fi
  155. if [ "${{ inputs.unicodefix }}" = "true" ]; then
  156. cat <<'EOF' >> release_body.md
  157. -> unicode fix
  158. EOF
  159. fi
  160. if [ "${{ inputs.zeromount }}" = "true" ]; then
  161. cat <<'EOF' >> release_body.md
  162. -> Zeromount https://github.com/Enginex0/zeromount
  163. EOF
  164. fi
  165. if [ "${{ inputs.droidspace }}" = "true" ]; then
  166. cat <<'EOF' >> release_body.md
  167. -> droidspaces support https://github.com/ravindu644/Droidspaces-OSS
  168. EOF
  169. fi
  170. if [ "${{ inputs.ntsync }}" = "true" ]; then
  171. cat <<'EOF' >> release_body.md
  172. -> ntsync
  173. EOF
  174. fi
  175. if [ "${{ inputs.bbr }}" = "true" ]; then
  176. cat <<'EOF' >> release_body.md
  177. -> TCP BBRV3 (better TCP congestion and faster internet)
  178. EOF
  179. fi
  180. cat <<'EOF' >> release_body.md
  181. Notes:
  182. - The only modifications to Samsung Kernels at this time are KSUN and SUSFS. Everything else is left at default settings.
  183. - Currently no support for KernelPatch-Next/KPM for the time being.
  184. Module:
  185. -> https://github.com/sidex15/ksu_module_susfs
  186. -> https://github.com/rrr333nnn333/BRENE
  187. Manager:
  188. -> KSUN: https://github.com/KernelSU-Next/KernelSU-Next
  189. EOF
  190. - name: Create GitHub Release
  191. uses: softprops/action-gh-release@v2
  192. with:
  193. tag_name: ${{ env.NEW_TAG }}
  194. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  195. files: ""
  196. name: ${{ env.RELEASE_NAME }}
  197. body_path: release_body.md
  198. - name: Upload Release Assets
  199. run: |
  200. shopt -s nullglob
  201. anykernel_dirs=(./downloaded-artifacts/*/)
  202. if [ ${#anykernel_dirs[@]} -eq 0 ]; then
  203. echo "No artifact directories found under ./downloaded-artifacts; skipping upload."
  204. else
  205. for dir in "${anykernel_dirs[@]}"; do
  206. # Check if this is an AnyKernel3 artifact directory
  207. if [[ "$(basename "$dir")" == *"-AnyKernel3" ]]; then
  208. artifact_name=$(basename "$dir")
  209. echo "Creating ZIP for $artifact_name..."
  210. # Navigate into the directory and zip its contents directly
  211. cd "$dir"
  212. zip -r -9 "../../${artifact_name}.zip" ./*
  213. cd - > /dev/null
  214. echo "Uploading ${artifact_name}.zip..."
  215. gh release upload ${{ env.NEW_TAG }} "${artifact_name}.zip"
  216. fi
  217. done
  218. fi
  219. # - name: Send Telegram Notification
  220. # if: inputs.release_type != 'Actions'
  221. # run: |
  222. # RELEASE_TYPE_TEXT=""
  223. # if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  224. # RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  225. # else
  226. # RELEASE_TYPE_TEXT="🚀 *Release*"
  227. # fi
  228. #
  229. # curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  230. # -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  231. # -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  232. # -F text="
  233. # 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  234. # 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  235. # ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  236. # [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  237. # -F parse_mode="Markdown"