main.yml 7.8 KB

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