main.yml 7.9 KB

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