main.yml 6.8 KB

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