main.yml 8.2 KB

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