main.yml 13 KB

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