main.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. name: Build Kernels
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. # push:
  7. # branches:
  8. # - main
  9. # paths:
  10. # - '.github/workflows/**'
  11. # pull_request:
  12. # branches:
  13. # - main
  14. # paths:
  15. # - '.github/workflows/**'
  16. workflow_dispatch:
  17. inputs:
  18. release_type:
  19. description: "Choose Release Type"
  20. required: true
  21. type: choice
  22. options:
  23. - Actions
  24. - Pre-Release
  25. - Release
  26. - Release (No Artifacts)
  27. default: Actions
  28. build_selection:
  29. description: "Choose which kernels to build"
  30. required: true
  31. type: choice
  32. options:
  33. - All
  34. - Android12-5.10
  35. - Android13-5.10
  36. - Android13-5.15
  37. - Android14-5.15
  38. - Android14-6.1
  39. - Android15-6.6
  40. - Build Test
  41. default: All
  42. jobs:
  43. build-a12-5-10:
  44. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android12-5.10') && inputs.release_type != 'Release (No Artifacts)'
  45. uses: ./.github/workflows/kernel-a12-5-10.yml
  46. secrets: inherit
  47. build-a13-5-10:
  48. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android13-5.10') && inputs.release_type != 'Release (No Artifacts)'
  49. uses: ./.github/workflows/kernel-a13-5-10.yml
  50. secrets: inherit
  51. build-a13-5-15:
  52. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android13-5.15') && inputs.release_type != 'Release (No Artifacts)'
  53. uses: ./.github/workflows/kernel-a13-5-15.yml
  54. secrets: inherit
  55. build-a14-5-15:
  56. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android14-5.15') && inputs.release_type != 'Release (No Artifacts)'
  57. uses: ./.github/workflows/kernel-a14-5-15.yml
  58. secrets: inherit
  59. build-a14-6-1:
  60. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android14-6.1') && inputs.release_type != 'Release (No Artifacts)'
  61. uses: ./.github/workflows/kernel-a14-6-1.yml
  62. secrets: inherit
  63. build-a15-6-6:
  64. if: (inputs.build_selection == 'All' || inputs.build_selection == 'Android15-6.6') && inputs.release_type != 'Release (No Artifacts)'
  65. uses: ./.github/workflows/kernel-a15-6-6.yml
  66. secrets: inherit
  67. build-test:
  68. if: inputs.build_selection == 'Build Test'
  69. uses: ./.github/workflows/kernel-build-check.yml
  70. secrets: inherit
  71. release:
  72. runs-on: ubuntu-latest
  73. if: inputs.build_selection == 'All' && inputs.release_type != 'Actions' && (inputs.release_type == 'Release (No Artifacts)' || success())
  74. needs:
  75. - build-a12-5-10
  76. - build-a13-5-10
  77. - build-a13-5-15
  78. - build-a14-5-15
  79. - build-a14-6-1
  80. - build-a15-6-6
  81. env:
  82. GH_TOKEN: ${{ github.token }}
  83. RELEASE_NAME: "GKI Kernels With WKSU & SUSFS v1.5.12"
  84. RELEASE_BODY: ""
  85. steps:
  86. # # - name: Maximize Build Space
  87. # uses: AdityaGarg8/remove-unwanted-software@v5
  88. # with:
  89. # remove-dotnet: 'true' # Frees ~2 GB
  90. # remove-android: 'true' # Frees ~9 GB
  91. # remove-haskell: 'true' # Frees ~5.2 GB
  92. # remove-codeql: 'true' # Frees ~5.4 GB
  93. # remove-docker-images: 'true' # Frees ~3.2 GB
  94. # remove-large-packages: 'true' # Frees ~3.1 GB
  95. # remove-swapfile: 'true' # Frees ~4 GB
  96. # remove-cached-tools: 'false' # Avoid unless confirmed safe
  97. # verbose: 'true' # Enable detailed logging
  98. - name: Checkout code
  99. uses: actions/checkout@v4
  100. - name: Get commit hashes and generate commit URLs
  101. run: |
  102. GITLAB_OWNER="simonpunk"
  103. GITLAB_REPO="susfs4ksu"
  104. declare -A BRANCH_MAP=(
  105. ["gki_android12_5_10"]="gki-android12-5.10"
  106. ["gki_android13_5_10"]="gki-android13-5.10"
  107. ["gki_android13_5_15"]="gki-android13-5.15"
  108. ["gki_android14_5_15"]="gki-android14-5.15"
  109. ["gki_android14_6_1"]="gki-android14-6.1"
  110. ["gki_android15_6_6"]="gki-android15-6.6"
  111. )
  112. for var_name in "${!BRANCH_MAP[@]}"; do
  113. branch_name="${BRANCH_MAP[$var_name]}"
  114. COMMIT_HASH=$(git ls-remote https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO.git refs/heads/$branch_name | awk '{ print $1 }')
  115. if [[ -n "$COMMIT_HASH" ]]; then
  116. COMMIT_URL="https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO/-/commit/$COMMIT_HASH"
  117. echo "$branch_name Commit: $COMMIT_HASH"
  118. echo "$branch_name Commit URL: $COMMIT_URL"
  119. echo "COMMIT_HASH_${var_name}=$COMMIT_HASH" >> "$GITHUB_ENV"
  120. echo "COMMIT_URL_${var_name}=$COMMIT_URL" >> "$GITHUB_ENV"
  121. fi
  122. done
  123. - name: Get KernelSU variant refs and links
  124. run: |
  125. # Get WKSU latest commit from wild branch
  126. WKSU_REF=$(git ls-remote "https://github.com/WildKernels/Wild_KSU.git" refs/heads/wild | awk '{print $1}')
  127. WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_REF"
  128. echo "WKSU_REF=$WKSU_REF" >> $GITHUB_ENV
  129. echo "WKSU_URL=$WKSU_URL" >> $GITHUB_ENV
  130. # Get Baseband-guard latest commit from main branch
  131. BBG_REF=$(git ls-remote "https://github.com/vc-teahouse/Baseband-guard.git" refs/heads/main | awk '{print $1}')
  132. BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_REF"
  133. echo "BBG_REF=$BBG_REF" >> $GITHUB_ENV
  134. echo "BBG_URL=$BBG_URL" >> $GITHUB_ENV
  135. - name: Generate New Tag
  136. if: inputs.release_type != 'Actions'
  137. run: |
  138. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "")
  139. if [ -z "$LATEST_TAG" ]; then
  140. LATEST_TAG="v1.5.12-r0"
  141. fi
  142. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  143. echo "New tag: $NEW_TAG"
  144. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  145. - name: Set tag for Actions only
  146. if: inputs.release_type == 'Actions'
  147. run: |
  148. echo "NEW_TAG=actions-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
  149. - name: Download Artifacts
  150. if: inputs.release_type != 'Release (No Artifacts)'
  151. uses: actions/download-artifact@v5
  152. with:
  153. path: ./downloaded-artifacts
  154. pattern: 'WKSU-*-AnyKernel3'
  155. - name: Set release body
  156. run: |
  157. cat << 'EOF' > release_body.md
  158. **IMPORTANT DISCLAIMER**
  159. This software is provided for testing and educational purposes only. Use at your own risk.
  160. The developers are not responsible for any damage, data loss, or issues that may occur.
  161. Please ensure you have proper backups before installation.
  162. 🔹 Normal
  163. - Default kernel configuration
  164. - Standard kernel module loading behavior
  165. - Recommended for most users
  166. 🔹 Bypass
  167. - Includes module check bypass modifications
  168. - What are kernel modules? Kernel modules are pieces of code that can be loaded into the kernel at runtime to extend functionality (like device drivers, filesystem support, etc.). These are different from KernelSU/Magisk modules.
  169. - The Problem: Sometimes when installing a custom kernel, the device tries to load a kernel module that fails due to version mismatches, missing dependencies, or signature verification issues. This can cause boot failures or device instability.
  170. - The Solution: This version changes one line from false to true to force load the kernel module, bypassing the failure check that would normally prevent loading.
  171. Features:
  172. -> Wild KSU
  173. -> Multi Manager Support for WKSU, KernelSU-Next! Needs Testing: KSU, MKSU RKSU, xxKSU, KowSU and SukiSU (Best compatibility with WKSU, no support will be provided for other managers)
  174. -> SUSFS ඞ v1.5.12
  175. -> Scope-Minimized Manual hooks v1.4
  176. -> Ptrace Patch Support for Older Kernels (<5.16)
  177. -> IPSet Support for Advanced Network Filtering
  178. -> Wireguard Support
  179. -> BBR v1 Support
  180. -> Added BBG support to prevent unauthorised writes to certain partitions: https://github.com/vc-teahouse/Baseband-guard
  181. 🔹 BBG (Baseband-guard)
  182. - A lightweight LSM (Linux Security Module) for Android kernel
  183. - Blocks unauthorized writes to critical partitions/device nodes
  184. - Prevents malicious tampering with baseband and boot chain
  185. - Kernel-level protection via LSM hooks
  186. - Reduces risk of soft-brick/hard-brick issues
  187. Notes:
  188. -> SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  189. -> Official Kernel Flasher is broken with latest susfs, try https://github.com/fatalcoder524/KernelFlasher/
  190. -> **boot.img files**: Available as CI artifacts only (not included in releases) - download from the Actions tab
  191. -> **Warning**: boot.img files may not boot on some devices
  192. -> **Note:** For detailed commit information and component versions, please check the [build summary](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) in the GitHub Actions workflow that generated this release.
  193. Module:
  194. -> https://github.com/sidex15/ksu_module_susfs
  195. Managers:
  196. -> WKSU: https://github.com/WildKernels/Wild_KSU
  197. -> Next: https://github.com/KernelSU-Next/KernelSU-Next
  198. EOF
  199. - name: Create GitHub Release
  200. if: inputs.release_type != 'Actions'
  201. uses: softprops/action-gh-release@v2
  202. with:
  203. tag_name: ${{ env.NEW_TAG }}
  204. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  205. files: ""
  206. name: ${{ env.RELEASE_NAME }}
  207. body_path: release_body.md
  208. - name: Upload Release Assets
  209. if: inputs.release_type != 'Actions' && inputs.release_type != 'Release (No Artifacts)'
  210. run: |
  211. for dir in ./downloaded-artifacts/*/; do
  212. # Create ZIP files from AnyKernel3 directories
  213. if [ -d "$dir/AnyKernel3" ]; then
  214. artifact_name=$(basename "$dir")
  215. echo "Creating ZIP for $artifact_name..."
  216. cd "$dir"
  217. zip -r -9 "${artifact_name}-AnyKernel3.zip" AnyKernel3/
  218. echo "Uploading ${artifact_name}.zip..."
  219. gh release upload ${{ env.NEW_TAG }} "${artifact_name}-AnyKernel3.zip"
  220. cd - > /dev/null
  221. fi
  222. done
  223. - name: Display Files Uploaded
  224. if: inputs.release_type != 'Actions' && inputs.release_type != 'Release (No Artifacts)'
  225. run: |
  226. echo "GitHub release created with the following files:"
  227. ls ./downloaded-artifacts/**/*
  228. - name: Send Telegram Notification
  229. if: inputs.release_type != 'Actions'
  230. run: |
  231. RELEASE_TYPE_TEXT=""
  232. if [ "${{ inputs.release_type }}" == "Pre-Release" ]; then
  233. RELEASE_TYPE_TEXT="🧪 *Pre-Release*"
  234. elif [ "${{ inputs.release_type }}" == "Release (No Artifacts)" ]; then
  235. RELEASE_TYPE_TEXT="🚀 *Release*"
  236. else
  237. RELEASE_TYPE_TEXT="🚀 *Release*"
  238. fi
  239. curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
  240. -F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
  241. -F message_thread_id="${{ secrets.TELEGRAM_TOPIC_ID_GKI }}" \
  242. -F text="
  243. 🌽 *New Kernel $RELEASE_TYPE_TEXT Uploaded*
  244. 📦 *Repository:* [${{ github.repository }}](https://github.com/${{ github.repository }})
  245. ✏️ *Commit:* [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
  246. [🔗 View GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ env.NEW_TAG }})" \
  247. -F parse_mode="Markdown"