| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- name: Build Kernels
- permissions:
- contents: write
- actions: write
- on:
- workflow_dispatch:
- inputs:
- release_type:
- description: "Release Type"
- type: choice
- options: [ Actions, Pre-Release, Release ]
- default: Actions
- kernel_build_version:
- description: "Kernel Version to Build"
- type: choice
- options:
- - all
- - a12-5-10
- - a13-5-10
- - a13-5-15
- - a14-5-15
- - a14-6-1
- - a15-6-6
- - a16-6-12
- default: all
- feature_set:
- description: "Feature Set"
- type: choice
- options:
- - KSUN+SUSFS+BBG+NET
- - KSUN+SUSFS
- - KSUN+BBG
- - KSUN+NET
- - BBG
- - None
- - All
- default: All
- ksu_commit:
- description: "KSU Commit (optional)"
- type: string
- default: ""
- required: false
- variant:
- description: "Build Variant (All, Normal, Bypass, Wild)"
- type: choice
- options:
- - All
- - Normal
- - Bypass
- - Wild
- default: Normal
- jobs:
- fetch-commits:
- runs-on: ubuntu-latest
- outputs:
- ksu_commit: ${{ steps.fetch.outputs.ksu_commit }}
- anykernel_commit: ${{ steps.fetch.outputs.anykernel_commit }}
- patches_commit: ${{ steps.fetch.outputs.patches_commit }}
- susfs_commit: ${{ steps.fetch.outputs.susfs_commit }}
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v5
- - name: Fetch Commits
- id: fetch
- uses: ./.github/actions/fetch-commits
- with:
- ksu_commit: ${{ inputs.ksu_commit }}
- build-a12-5-10:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a12-5-10' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a12-5.10.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a13-5-10:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-10' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a13-5.10.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a13-5-15:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a13-5-15' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a13-5.15.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a14-5-15:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-5-15' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a14-5.15.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a14-6-1:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a14-6-1' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a14-6.1.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a15-6-6:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a15-6-6' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a15-6.6.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- build-a16-6-12:
- if: ${{ inputs.kernel_build_version == 'all' || inputs.kernel_build_version == 'a16-6-12' }}
- needs: fetch-commits
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/kernel-config/a16-6.12.json
- ksu_commit: ${{ inputs.ksu_commit || needs.fetch-commits.outputs.ksu_commit }}
- anykernel_commit: ${{ needs.fetch-commits.outputs.anykernel_commit }}
- patches_commit: ${{ needs.fetch-commits.outputs.patches_commit }}
- susfs_commit: ${{ needs.fetch-commits.outputs.susfs_commit }}
- feature_set: ${{ inputs.feature_set || 'KSUN+SUSFS+BBG' }}
- variant: ${{ inputs.variant || 'Normal' }}
- secrets: inherit
- rej:
- if: always()
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- needs:
- - build-a12-5-10
- - build-a13-5-10
- - build-a13-5-15
- - build-a14-5-15
- - build-a14-6-1
- - build-a15-6-6
- - build-a16-6-12
- steps:
- - name: Download Misc Artifacts
- uses: actions/download-artifact@v7
- with:
- path: ./downloaded-artifacts
- pattern: '*-Normal-Rejects'
- merge-multiple: false
- - name: Process Reject Artifacts
- run: |
- mkdir -p aio-rejects
-
- # Iterate over Rejects artifacts in downloaded-artifacts
- for dir in ./downloaded-artifacts/*-Rejects; do
- # Ensure it is a directory
- [ -d "$dir" ] || continue
-
- dirname=$(basename "$dir")
- # Process each reject artifact
-
- # Get original name (remove -Rejects suffix)
- original_name=${dirname%-Rejects}
-
- mkdir -p "aio-rejects/$original_name"
-
- # Check for patch-rejects folder (legacy structure) or direct contents
- if [ -d "$dir/patch-rejects" ]; then
- # Legacy structure
- cp -r "$dir/patch-rejects/." "aio-rejects/$original_name/"
- else
- # Current structure
- cp -r "$dir/." "aio-rejects/$original_name/"
- fi
- done
-
- # Zip and upload if we found anything
- if [ "$(ls -A aio-rejects)" ]; then
- # Create a single zip of all rejects
- cd aio-rejects
- zip -r -q -9 ../AIO-REJ.zip .
- cd ..
- else
- echo "No rejects found to upload."
- fi
- - name: Upload AIO-REJ Artifact
- uses: actions/upload-artifact@v7
- with:
- name: AIO-REJ
- path: AIO-REJ.zip
- if-no-files-found: ignore
- release:
- runs-on: ubuntu-latest
- if: ${{ github.event_name == 'workflow_dispatch' && inputs.release_type != 'Actions' }}
- permissions:
- contents: write
- needs:
- - fetch-commits
- - build-a12-5-10
- - build-a13-5-10
- - build-a13-5-15
- - build-a14-5-15
- - build-a14-6-1
- - build-a15-6-6
- - build-a16-6-12
- env:
- GH_TOKEN: ${{ github.token }}
- RELEASE_NAME: "GKI Kernels With KernelSU-Next & SUSFS v2.1.0"
- RELEASE_BODY: ""
- outputs:
- new_tag: ${{ steps.tag.outputs.new_tag }}
- steps:
- - name: Validate Selected Builds
- run: |
- set -euo pipefail
- failed=0
- current_type="${{ inputs.kernel_build_version }}"
- check_selected() {
- local target="$1"
- local job_name="$2"
- local result="$3"
-
- if [[ "$current_type" == "all" || "$current_type" == "$target" ]]; then
- if [[ "$result" != "success" ]]; then
- echo "Required job $job_name did not succeed (result: $result)"
- failed=1
- fi
- fi
- }
- check_selected "a12-5-10" "build-a12-5-10" "${{ needs.build-a12-5-10.result }}"
- check_selected "a13-5-10" "build-a13-5-10" "${{ needs.build-a13-5-10.result }}"
- check_selected "a13-5-15" "build-a13-5-15" "${{ needs.build-a13-5-15.result }}"
- check_selected "a14-5-15" "build-a14-5-15" "${{ needs.build-a14-5-15.result }}"
- check_selected "a14-6-1" "build-a14-6-1" "${{ needs.build-a14-6-1.result }}"
- check_selected "a15-6-6" "build-a15-6-6" "${{ needs.build-a15-6-6.result }}"
- check_selected "a16-6-12" "build-a16-6-12" "${{ needs.build-a16-6-12.result }}"
- if [[ "$failed" -ne 0 ]]; then
- exit 1
- fi
- - name: Free Disk Space
- if: true
- uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
- with:
- remove_android: true
- remove_dotnet: true
- remove_haskell: true
- remove_tool_cache: true
- remove_swap: true
- remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
- remove_packages_one_command: true
- 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"
- rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
- rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
- testing: false
- - name: Checkout code
- uses: actions/checkout@v5
- - name: Generate New Tag
- id: tag
- if: inputs.release_type != 'Actions'
- run: |
- LATEST_TAG=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "v0.0.0")
- if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then
- LATEST_TAG="v0.0.0"
- fi
-
- if [[ "$LATEST_TAG" =~ ^(.*)-r([0-9]+)$ ]]; then
- VERSION="${BASH_REMATCH[1]}"
- REV="${BASH_REMATCH[2]}"
- NEW_REV=$((REV + 1))
- NEW_TAG="${VERSION}-r${NEW_REV}"
- else
- NEW_TAG="${LATEST_TAG}-r1"
- fi
-
- echo "Latest tag: $LATEST_TAG"
- echo "New tag: $NEW_TAG"
- echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
- echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
- - name: Set release body
- run: |
- set -e
- FEATURE_SET="${{ inputs.feature_set }}"
- KSUN_COMMIT="${{ needs.fetch-commits.outputs.ksu_commit }}"
- KSUN_TAG="${{ needs.fetch-commits.outputs.ksu_tag }}"
- AK3_COMMIT="${{ needs.fetch-commits.outputs.anykernel_commit }}"
- PATCHES_COMMIT="${{ needs.fetch-commits.outputs.patches_commit }}"
- SUSFS_MAP="${{ needs.fetch-commits.outputs.susfs_commit }}"
- BBG_COMMIT="${{ needs.fetch-commits.outputs.bbg_commit }}"
- SUSFS_VERSION="v2.1.0"
- : > release_body.md
- {
- echo
- echo "**IMPORTANT DISCLAIMER**"
- echo "This software is provided for testing and educational purposes only. Use at your own risk."
- echo "The developers are not responsible for any damage, data loss, or issues that may occur."
- echo "Please ensure you have proper backups before installation."
- echo
- echo "## 🔧 Build Configuration"
- echo "| Component | Version/Setting |"
- echo "|---|---|"
- echo "| Feature Set | ${FEATURE_SET} |"
- echo "| KernelSU-Next Commit | ${KSUN_COMMIT} |"
- echo "| KernelSU-Next Tag | ${KSUN_TAG:-None} |"
- echo "| SUSFS Version | ${SUSFS_VERSION} |"
- echo "| AnyKernel3 Commit | ${AK3_COMMIT} |"
- echo "| Kernel Patches Commit | ${PATCHES_COMMIT} |"
- echo "| BBG Commit | ${BBG_COMMIT} |"
- echo "| Optimization Level | O2 |"
- echo "| Clean Build | ❌ No (ccache enabled) |"
- echo
- echo "## 📌 SUSFS Branch Mapping"
- echo "| Kernel Version | SUSFS Commit |"
- echo "|---|---|"
- } >> release_body.md
- echo "$SUSFS_MAP" | tr ',' '\n' | while IFS=':' read -r branch commit; do
- [ -n "${branch:-}" ] || continue
- [ -n "${commit:-}" ] || continue
- kernel_version="${branch#gki-}"
- echo "| ${kernel_version} | ${commit} |" >> release_body.md
- done
- {
- echo
- echo "## ✨ Features & Capabilities"
- } >> release_body.md
- if [[ "$FEATURE_SET" == *"KSUN"* ]]; then
- {
- echo "### 🔐 Root Management"
- echo "- KernelSU-Next (kernel-level root)"
- } >> release_body.md
- fi
- if [[ "$FEATURE_SET" == *"SUSFS"* ]]; then
- echo "- SUSFS ${SUSFS_VERSION}" >> release_body.md
- fi
- {
- echo
- echo "### 🚀 Performance & Networking"
- echo "- BBRv3 TCP Congestion Control"
- echo "- IP Set support"
- echo "- TTL target support (IPv4/IPv6)"
- echo
- echo "### 🔹 Bypass Builds"
- echo "- Includes module check bypass variant (Bypass)"
- echo
- echo "## 📦 Release Files"
- echo "- AnyKernel3: uploaded as ZIP in the Release"
- echo "- Boot images: uploaded as raw .img files in the Release"
- echo
- echo "## 📥 Recommended Tools"
- echo "- Kernel Flasher: https://github.com/fatalcoder524/KernelFlasher/"
- echo "- KernelSU-Next Manager: https://github.com/KernelSU-Next/KernelSU-Next"
- echo "- SUSFS Module: https://github.com/sidex15/ksu_module_susfs"
- } >> release_body.md
- if [[ "$FEATURE_SET" == *"BBG"* ]]; then
- {
- echo
- echo "### 🛡️ Security & Privacy"
- echo "- Baseband Guard (BBG): https://github.com/vc-teahouse/Baseband-guard"
- } >> release_body.md
- fi
- - name: Workflow Summary
- if: ${{ always() }}
- run: |
- set -e
- KSUN_COMMIT="${{ needs.fetch-commits.outputs.ksu_commit }}"
- KSUN_TAG="${{ needs.fetch-commits.outputs.ksu_tag }}"
- AK3_COMMIT="${{ needs.fetch-commits.outputs.anykernel_commit }}"
- PATCHES_COMMIT="${{ needs.fetch-commits.outputs.patches_commit }}"
- SUSFS_MAP="${{ needs.fetch-commits.outputs.susfs_commit }}"
- BBG_COMMIT="${{ needs.fetch-commits.outputs.bbg_commit }}"
- short() { echo "${1:0:8}"; }
- {
- echo "## 📦 Components"
- echo "| Component | Branch / Tag | Commit / Version |"
- echo "|---|---|---|"
- echo "| KernelSU-Next | ${KSUN_TAG:-dev} | $(short "$KSUN_COMMIT") |"
- echo "| AnyKernel3 | gki-2.0 | $(short "$AK3_COMMIT") |"
- echo "| Kernel Patches | main | $(short "$PATCHES_COMMIT") |"
- echo "| BBG | main | $(short "$BBG_COMMIT") |"
- } >> "$GITHUB_STEP_SUMMARY"
- {
- echo
- echo "## 📌 SUSFS Branch Mapping"
- echo "| Kernel Version | SUSFS Commit |"
- echo "|---|---|"
- } >> "$GITHUB_STEP_SUMMARY"
- echo "$SUSFS_MAP" | tr ',' '\n' | while IFS=':' read -r branch commit; do
- [ -n "${branch:-}" ] || continue
- [ -n "${commit:-}" ] || continue
- kernel_version="${branch#gki-}"
- echo "| ${kernel_version} | ${commit} |" >> "$GITHUB_STEP_SUMMARY"
- done
- - name: Download AnyKernel3 Artifacts
- uses: actions/download-artifact@v7
- with:
- path: release-assets
- pattern: '*-AnyKernel3'
- merge-multiple: false
- - name: Download Boot Image Artifacts
- uses: actions/download-artifact@v7
- with:
- path: release-assets
- pattern: '*-BootImages'
- merge-multiple: false
- - name: Zip AnyKernel3 for Release
- run: |
- set -e
- shopt -s nullglob
- for dir in release-assets/*-AnyKernel3; do
- zip_name="${dir}.zip"
- rm -f "$zip_name"
- cd "$dir"
- zip -r -q -9 "../$(basename "$zip_name")" .
- cd - >/dev/null
- done
- - name: Create Release
- uses: softprops/action-gh-release@v1
- with:
- tag_name: ${{ steps.tag.outputs.new_tag }}
- name: ${{ steps.tag.outputs.new_tag }}
- body_path: release_body.md
- draft: false
- prerelease: ${{ inputs.release_type == 'Pre-Release' }}
- files: |
- release-assets/**/*.zip
- release-assets/**/*-boot*.img
|