main.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. name: Build Kernels
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. release_type:
  9. description: "Release Type"
  10. type: choice
  11. options: [ Actions, Pre-Release, Release ]
  12. default: Actions
  13. kernel_build_version:
  14. description: "Kernel Version to Build"
  15. type: choice
  16. options:
  17. - all
  18. - a12-5-10
  19. - a13-5-10
  20. - a13-5-15
  21. - a14-5-15
  22. - a14-6-1
  23. - a15-6-6
  24. - a16-6-12
  25. - lts
  26. - custom
  27. - testing
  28. - bypass
  29. default: custom
  30. feature_set:
  31. description: "Feature Set"
  32. type: choice
  33. options:
  34. - WKSU+SUSFS+BBG
  35. - WKSU+BBG
  36. - WKSU
  37. - BBG
  38. - None
  39. default: WKSU+SUSFS+BBG
  40. ksu_commit:
  41. description: "KSU Commit (optional)"
  42. type: string
  43. default: ""
  44. required: false
  45. push:
  46. branches:
  47. - main
  48. jobs:
  49. fetch-commits:
  50. runs-on: ubuntu-latest
  51. outputs:
  52. ksu_commit: ${{ steps.fetch.outputs.ksu_commit }}
  53. anykernel_commit: ${{ steps.fetch.outputs.anykernel_commit }}
  54. patches_commit: ${{ steps.fetch.outputs.patches_commit }}
  55. susfs_commit: ${{ steps.fetch.outputs.susfs_commit }}
  56. steps:
  57. - name: Checkout Repository
  58. uses: actions/checkout@v4
  59. - name: Fetch Commits
  60. id: fetch
  61. uses: ./.github/actions/fetch-commits
  62. with:
  63. ksu_commit: ${{ inputs.ksu_commit }}
  64. build-a12-5-10:
  65. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a12-5-10' }}
  66. needs: fetch-commits
  67. uses: ./.github/workflows/prepare.yml
  68. with:
  69. config_file: .github/kernel-config/a12-5.10.json
  70. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  71. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  72. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  73. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  74. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  75. secrets: inherit
  76. build-a13-5-10:
  77. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-10' }}
  78. needs: fetch-commits
  79. uses: ./.github/workflows/prepare.yml
  80. with:
  81. config_file: .github/kernel-config/a13-5.10.json
  82. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  83. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  84. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  85. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  86. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  87. secrets: inherit
  88. build-a13-5-15:
  89. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-15' }}
  90. needs: fetch-commits
  91. uses: ./.github/workflows/prepare.yml
  92. with:
  93. config_file: .github/kernel-config/a13-5.15.json
  94. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  95. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  96. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  97. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  98. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  99. secrets: inherit
  100. build-a14-5-15:
  101. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-5-15' }}
  102. needs: fetch-commits
  103. uses: ./.github/workflows/prepare.yml
  104. with:
  105. config_file: .github/kernel-config/a14-5.15.json
  106. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  107. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  108. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  109. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  110. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  111. secrets: inherit
  112. build-a14-6-1:
  113. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-6-1' }}
  114. needs: fetch-commits
  115. uses: ./.github/workflows/prepare.yml
  116. with:
  117. config_file: .github/kernel-config/a14-6.1.json
  118. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  119. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  120. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  121. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  122. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  123. secrets: inherit
  124. build-a15-6-6:
  125. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a15-6-6' }}
  126. needs: fetch-commits
  127. uses: ./.github/workflows/prepare.yml
  128. with:
  129. config_file: .github/kernel-config/a15-6.6.json
  130. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  131. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  132. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  133. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  134. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  135. secrets: inherit
  136. build-a16-6-12:
  137. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a16-6-12' }}
  138. needs: fetch-commits
  139. uses: ./.github/workflows/prepare.yml
  140. with:
  141. config_file: .github/kernel-config/a16-6.12.json
  142. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  143. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  144. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  145. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  146. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  147. secrets: inherit
  148. build-lts:
  149. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'lts' || github.event_name == 'push' }}
  150. needs: fetch-commits
  151. uses: ./.github/workflows/prepare.yml
  152. with:
  153. config_file: .github/kernel-config/lts.json
  154. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  155. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  156. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  157. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  158. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  159. secrets: inherit
  160. build-custom:
  161. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'custom' }}
  162. needs: fetch-commits
  163. uses: ./.github/workflows/prepare.yml
  164. with:
  165. config_file: .github/kernel-config/custom.json
  166. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  167. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  168. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  169. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  170. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  171. secrets: inherit
  172. build-testing:
  173. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'testing' || github.event_name == 'push' }}
  174. needs: fetch-commits
  175. uses: ./.github/workflows/prepare.yml
  176. with:
  177. config_file: .github/kernel-config/testing.json
  178. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  179. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  180. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  181. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  182. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  183. secrets: inherit
  184. build-bypass:
  185. if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'bypass' }}
  186. needs: fetch-commits
  187. uses: ./.github/workflows/prepare.yml
  188. with:
  189. config_file: .github/kernel-config/bypass.json
  190. ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
  191. anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
  192. patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
  193. susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
  194. feature_set: ${{ inputs.feature_set || 'WKSU+SUSFS+BBG' }}
  195. secrets: inherit
  196. rej:
  197. if: always()
  198. runs-on: ubuntu-latest
  199. permissions:
  200. actions: read
  201. contents: read
  202. needs:
  203. - build-a12-5-10
  204. - build-a13-5-10
  205. - build-a13-5-15
  206. - build-a14-5-15
  207. - build-a14-6-1
  208. - build-a15-6-6
  209. - build-a16-6-12
  210. - build-custom
  211. - build-lts
  212. - build-testing
  213. - build-bypass
  214. steps:
  215. - name: Download Misc Artifacts
  216. uses: actions/download-artifact@v4
  217. with:
  218. path: ./downloaded-artifacts
  219. pattern: '*-Rejects'
  220. merge-multiple: false
  221. - name: Process Reject Artifacts
  222. run: |
  223. mkdir -p aio-rejects
  224. # Iterate over Rejects artifacts in downloaded-artifacts
  225. for dir in ./downloaded-artifacts/*-Rejects; do
  226. # Ensure it is a directory
  227. [ -d "$dir" ] || continue
  228. dirname=$(basename "$dir")
  229. # Process each reject artifact
  230. # Get original name (remove -Rejects suffix)
  231. original_name=${dirname%-Rejects}
  232. mkdir -p "aio-rejects/$original_name"
  233. # Check for patch-rejects folder (legacy structure) or direct contents
  234. if [ -d "$dir/patch-rejects" ]; then
  235. # Legacy structure
  236. cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
  237. else
  238. # Current structure
  239. cp -r "$dir/." "aio-rejects/$original_name/"
  240. fi
  241. done
  242. # Zip and upload if we found anything
  243. if [ "$(ls -A aio-rejects)" ]; then
  244. # Create a single zip of all rejects
  245. cd aio-rejects
  246. zip -r -q -9 ../AIO-REJ.zip .
  247. cd ..
  248. else
  249. echo "No rejects found to upload."
  250. fi
  251. - name: Upload AIO-REJ Artifact
  252. uses: actions/upload-artifact@v4
  253. with:
  254. name: AIO-REJ
  255. path: AIO-REJ.zip
  256. if-no-files-found: ignore
  257. release:
  258. runs-on: ubuntu-latest
  259. if: ${{ github.event_name == 'workflow_dispatch' && inputs.release_type != 'Actions' }}
  260. permissions:
  261. contents: write
  262. needs:
  263. - build-a12-5-10
  264. - build-a13-5-10
  265. - build-a13-5-15
  266. - build-a14-5-15
  267. - build-a14-6-1
  268. - build-a15-6-6
  269. - build-a16-6-12
  270. - build-lts
  271. - build-custom
  272. - build-testing
  273. - build-bypass
  274. env:
  275. GH_TOKEN: ${{ github.token }}
  276. RELEASE_NAME: "GKI Kernels With WKSU & SUSFS v2.0.0"
  277. RELEASE_BODY: ""
  278. outputs:
  279. new_tag: ${{ steps.tag.outputs.new_tag }}
  280. steps:
  281. - name: Validate Selected Builds
  282. run: |
  283. set -euo pipefail
  284. failed=0
  285. current_type="${{ inputs.kernel_build_version }}"
  286. check_selected() {
  287. local target="$1"
  288. local job_name="$2"
  289. local result="$3"
  290. if [[ "$current_type" == "all" || "$current_type" == "$target" ]]; then
  291. if [[ "$result" != "success" ]]; then
  292. echo "Required job $job_name did not succeed (result: $result)"
  293. failed=1
  294. fi
  295. fi
  296. }
  297. check_selected "a12-5-10" "build-a12-5-10" "${{ needs.build-a12-5-10.result }}"
  298. check_selected "a13-5-10" "build-a13-5-10" "${{ needs.build-a13-5-10.result }}"
  299. check_selected "a13-5-15" "build-a13-5-15" "${{ needs.build-a13-5-15.result }}"
  300. check_selected "a14-5-15" "build-a14-5-15" "${{ needs.build-a14-5-15.result }}"
  301. check_selected "a14-6-1" "build-a14-6-1" "${{ needs.build-a14-6-1.result }}"
  302. check_selected "a15-6-6" "build-a15-6-6" "${{ needs.build-a15-6-6.result }}"
  303. check_selected "a16-6-12" "build-a16-6-12" "${{ needs.build-a16-6-12.result }}"
  304. check_selected "custom" "build-custom" "${{ needs.build-custom.result }}"
  305. check_selected "lts" "build-lts" "${{ needs.build-lts.result }}"
  306. check_selected "testing" "build-testing" "${{ needs.build-testing.result }}"
  307. if [[ "$failed" -ne 0 ]]; then
  308. exit 1
  309. fi
  310. - name: Free Disk Space
  311. if: true
  312. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  313. with:
  314. remove_android: true
  315. remove_dotnet: true
  316. remove_haskell: true
  317. remove_tool_cache: true
  318. remove_swap: true
  319. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  320. remove_packages_one_command: true
  321. 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"
  322. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  323. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  324. testing: false
  325. - name: Checkout code
  326. uses: actions/checkout@v4
  327. - name: Generate New Tag
  328. id: tag
  329. if: inputs.release_type != 'Actions'
  330. run: |
  331. LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "v0.0.0")
  332. if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then
  333. LATEST_TAG="v0.0.0"
  334. fi
  335. if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
  336. VERSION="${BASH_REMATCH[1]}"
  337. REV="${BASH_REMATCH[2]}"
  338. NEW_REV=$((REV + 1))
  339. NEW_TAG="${VERSION}-r${NEW_REV}"
  340. else
  341. NEW_TAG="${LATEST_TAG}-r1"
  342. fi
  343. echo "Latest tag: $LATEST_TAG"
  344. echo "New tag: $NEW_TAG"
  345. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  346. echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
  347. - name: Set release body
  348. run: |
  349. cat << 'EOF' > release_body.md
  350. **Automated Release**
  351. This release was automatically generated by GitHub Actions.
  352. **Builds:**
  353. EOF
  354. # Add details about included builds
  355. if [[ "${{ inputs.kernel_build_version }}" == "all" ]]; then
  356. echo "- All Kernel Versions" >> release_body.md
  357. else
  358. echo "- ${{ inputs.kernel_build_version }}" >> release_body.md
  359. fi
  360. - name: Create Release
  361. uses: softprops/action-gh-release@v1
  362. with:
  363. tag_name: ${{ steps.tag.outputs.new_tag }}
  364. name: ${{ steps.tag.outputs.new_tag }}
  365. body_path: release_body.md
  366. draft: false
  367. prerelease: ${{ inputs.release_type == 'Pre-Release' }}
  368. files: |
  369. AnyKernel3/**/*.zip
  370. AIO-REJ.zip