main.yml 8.4 KB

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