| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- name: Build Kernels
- permissions:
- contents: write
- actions: write
- on:
- workflow_dispatch:
- inputs:
- release_type:
- description: "Release Type"
- type: choice
- options:
- - Action
- - Pre-Release
- - Release
- default: Action
- kernel_build_version:
- description: "Kernel Version"
- type: choice
- options:
- - All
- - android12-5.10
- - android13-5.10
- - android13-5.15
- - android14-5.15
- - android14-6.1
- - android15-6.6
- - android16-6.12
- default: All
- feature_set:
- description: "Feature Set"
- type: choice
- options:
- - KSUN+SUSFS+BBG+NET+DS
- - KSUN+SUSFS+BBG
- - KSUN+SUSFS+NET
- - KSUN+SUSFS+DS
- - KSUN+SUSFS
- - KSUN+BBG
- - KSUN+NET
- - KSUN+DS
- - KSUN
- - NONE
- - FULL
- default: FULL
- use_repo:
- description: "Use repo for downloading kernel source"
- type: boolean
- default: true
- use_latest_commits:
- description: "Use branch tip for KernelSU and SUSFS instead of pinned commits"
- type: boolean
- default: true
- test_release_notes:
- description: "Test release notes only"
- type: boolean
- default: false
- jobs:
- build-android12-5-10:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android12-5.10') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android12-5.10.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android13-5-10:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android13-5.10') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android13-5.10.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android13-5-15:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android13-5.15') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android13-5.15.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android14-5-15:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android14-5.15') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android14-5.15.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android14-6-1:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android14-6.1') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android14-6.1.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android15-6-6:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android15-6.6') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android15-6.6.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- build-android16-6-12:
- if: ${{ !inputs.test_release_notes && (inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'android16-6.12') }}
- uses: ./.github/workflows/prepare.yml
- with:
- config_file: .github/config/android16-6.12.json
- feature_set: ${{ inputs.feature_set || 'FULL' }}
- use_repo: ${{ inputs.use_repo }}
- use_latest_commits: ${{ inputs.use_latest_commits }}
- secrets: inherit
- rej:
- if: ${{ !inputs.test_release_notes && always() }}
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- needs:
- - build-android12-5-10
- - build-android13-5-10
- - build-android13-5-15
- - build-android14-5-15
- - build-android14-6-1
- - build-android15-6-6
- - build-android16-6-12
- steps:
- - name: Download Misc Artifacts
- uses: actions/download-artifact@v7
- with:
- path: ./downloaded-artifacts
- pattern: '*-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
- KSUN_BRANCH="dev"
- # Create a single zip of all rejects
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
- git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- else
- echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
- git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- fi
- else
- echo "No rejects found to upload."
- fi
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- KSUN_COMMIT=$(git rev-parse HEAD)
- else
- KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
- # Checkout the specific commit
- echo "Checking out commit: $KSUN_COMMIT"
- git fetch --depth=50 origin "$KSUN_COMMIT"
- git checkout "$KSUN_COMMIT"
- 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-preview:
- runs-on: ubuntu-latest
- if: ${{ github.event_name == 'workflow_dispatch' && inputs.test_release_notes == true }}
- permissions:
- contents: read
- env:
- GH_TOKEN: ${{ github.token }}
- RELEASE_NOTES: .github/config/RELEASE_NOTES.md
- COMMITS_JSON: .github/config/commits.json
- steps:
- - name: Checkout code
- uses: actions/checkout@v5
- - name: Extract KernelSU Version Info
- id: ksu_version
- env:
- COMMITS_JSON_PATH: ${{ env.COMMITS_JSON }}
- run: |
- set -euo pipefail
- KSUN_BRANCH="dev"
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
- git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- else
- echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
- git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- fi
- cd /tmp/kernelsu-next
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- KSUN_COMMIT=$(git rev-parse HEAD)
- else
- # Extract KernelSU commit and branch from commits config
- KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
- echo "Checking out commit: $KSUN_COMMIT"
- git fetch --depth=50 origin "$KSUN_COMMIT"
- git checkout "$KSUN_COMMIT"
- fi
- # Extract version info
- COMMITS_COUNT=$(git rev-list --count HEAD)
- BASE_VERSION=30000
- KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
- # Extract git tag
- KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "no-tag")
- MANAGER_RUN_ID=$(curl -fsSL "https://api.github.com/repos/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml/runs?head_sha=${KSUN_COMMIT}" | jq -r '.workflow_runs[0].id // empty')
- if [[ -n "${MANAGER_RUN_ID:-}" ]]; then
- KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/runs/${MANAGER_RUN_ID}"
- else
- KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml"
- fi
- echo "Commits count: $COMMITS_COUNT"
- echo "KSU Version: $KSU_VERSION"
- echo "KSU Git Tag: $KSU_GIT_TAG"
- echo "KSU Manager: $KSU_MANAGER"
- # Export as environment for next step
- echo "KSUN_BRANCH=$KSUN_BRANCH" >> $GITHUB_ENV
- echo "KSUN_COMMIT=$KSUN_COMMIT" >> $GITHUB_ENV
- echo "KSU_COMMITS_COUNT=$COMMITS_COUNT" >> $GITHUB_ENV
- echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
- echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
- echo "KSU_MANAGER=$KSU_MANAGER" >> $GITHUB_ENV
- - name: Set release body
- run: |
- set -e
- RELEASE_NOTES_PATH="$RELEASE_NOTES"
- : > release_body.md
- python3 .github/scripts/render_release_body.py "$RELEASE_NOTES_PATH" > release_body.md
- - name: Publish release notes preview
- run: |
- {
- echo "## Release Notes Preview"
- echo
- cat release_body.md
- } >> "$GITHUB_STEP_SUMMARY"
- release:
- runs-on: ubuntu-latest
- if: ${{ github.event_name == 'workflow_dispatch' && !inputs.test_release_notes && (inputs.release_type == 'Pre-Release' || inputs.release_type == 'Release') }}
- permissions:
- contents: write
- needs:
- - build-android12-5-10
- - build-android13-5-10
- - build-android13-5-15
- - build-android14-5-15
- - build-android14-6-1
- - build-android15-6-6
- - build-android16-6-12
- env:
- GH_TOKEN: ${{ github.token }}
- RELEASE_NOTES: .github/config/RELEASE_NOTES.md
- COMMITS_JSON: .github/config/commits.json
- 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 "android12-5.10" "build-android12-5-10" "${{ needs.build-android12-5-10.result }}"
- check_selected "android13-5.10" "build-android13-5-10" "${{ needs.build-android13-5-10.result }}"
- check_selected "android13-5.15" "build-android13-5-15" "${{ needs.build-android13-5-15.result }}"
- check_selected "android14-5.15" "build-android14-5-15" "${{ needs.build-android14-5-15.result }}"
- check_selected "android14-6.1" "build-android14-6-1" "${{ needs.build-android14-6-1.result }}"
- check_selected "android15-6.6" "build-android15-6-6" "${{ needs.build-android15-6-6.result }}"
- check_selected "android16-6.12" "build-android16-6-12" "${{ needs.build-android16-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 != 'Action'
- run: |
- mapfile -t RELEASE_TAGS < <(gh api --paginate "repos/${{ github.repository }}/tags?per_page=100" --jq '.[].name' 2>/dev/null | grep -E '^r[0-9]+$' || true)
- LATEST_REV=0
- for TAG in "${RELEASE_TAGS[@]}"; do
- REV="${TAG#r}"
- if [[ "$REV" =~ ^[0-9]+$ && "$REV" -gt "$LATEST_REV" ]]; then
- LATEST_REV="$REV"
- fi
- done
- if [[ "$LATEST_REV" -gt 0 ]]; then
- NEW_TAG="r$((LATEST_REV + 1))"
- else
- NEW_TAG="r1"
- fi
- if [[ ${#RELEASE_TAGS[@]} -gt 0 ]]; then
- echo "Latest r-tag: r${LATEST_REV}"
- else
- echo "No existing r-tags found; starting at r1"
- fi
- echo "New tag: $NEW_TAG"
- echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
- echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
- - name: Set Release Title
- id: release_meta
- run: |
- set -euo pipefail
- # Format release title: convert rN -> Release N
- if [[ "${NEW_TAG}" =~ ^r([0-9]+)$ ]]; then
- REV_NUM="${BASH_REMATCH[1]}"
- release_title="Wild Kernels for GKI2 Devices 5.10+ Release ${REV_NUM}"
- else
- release_title="Wild Kernels for GKI2 Devices 5.10+ Release ${NEW_TAG}"
- fi
- echo "release_title=$release_title" >> "$GITHUB_OUTPUT"
- - name: Extract KernelSU Version Info
- id: ksu_version
- env:
- COMMITS_JSON_PATH: ${{ env.COMMITS_JSON }}
- run: |
- set -euo pipefail
- KSUN_BRANCH="dev"
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- echo "Cloning KernelSU-Next from full branch tip: $KSUN_BRANCH"
- git clone --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- else
- echo "Cloning KernelSU-Next from branch: $KSUN_BRANCH"
- git clone --depth=1 --branch "$KSUN_BRANCH" https://github.com/KernelSU-Next/KernelSU-Next.git /tmp/kernelsu-next
- fi
- cd /tmp/kernelsu-next
- if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
- KSUN_COMMIT=$(git rev-parse HEAD)
- else
- # Extract KernelSU commit and branch from commits config
- KSUN_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON_PATH")
- echo "Checking out commit: $KSUN_COMMIT"
- git fetch --depth=50 origin "$KSUN_COMMIT"
- git checkout "$KSUN_COMMIT"
- fi
- # Extract version info
- COMMITS_COUNT=$(git rev-list --count HEAD)
- BASE_VERSION=30000
- KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
- # Extract git tag
- KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "no-tag")
- MANAGER_RUN_ID=$(curl -fsSL "https://api.github.com/repos/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml/runs?head_sha=${KSUN_COMMIT}" | jq -r '.workflow_runs[0].id // empty')
- if [[ -n "${MANAGER_RUN_ID:-}" ]]; then
- KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/runs/${MANAGER_RUN_ID}"
- else
- KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml"
- fi
- echo "Commits count: $COMMITS_COUNT"
- echo "KSU Version: $KSU_VERSION"
- echo "KSU Git Tag: $KSU_GIT_TAG"
- echo "KSU Manager: $KSU_MANAGER"
- # Export as environment for next step
- echo "KSUN_BRANCH=$KSUN_BRANCH" >> $GITHUB_ENV
- echo "KSUN_COMMIT=$KSUN_COMMIT" >> $GITHUB_ENV
- echo "KSU_COMMITS_COUNT=$COMMITS_COUNT" >> $GITHUB_ENV
- echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
- echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
- echo "KSU_MANAGER=$KSU_MANAGER" >> $GITHUB_ENV
- - name: Set release body
- run: |
- set -e
- RELEASE_NOTES_PATH="$RELEASE_NOTES"
- : > release_body.md
- python3 .github/scripts/render_release_body.py "$RELEASE_NOTES_PATH" > release_body.md
- - name: Publish release notes preview
- run: |
- {
- echo "## Release Notes Preview"
- echo
- cat release_body.md
- } >> "$GITHUB_STEP_SUMMARY"
- - name: Download AnyKernel3 Artifacts
- uses: actions/download-artifact@v7
- with:
- path: release-assets
- pattern: '*-AnyKernel3'
- 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.release_meta.outputs.release_title }}
- body_path: release_body.md
- draft: false
- prerelease: ${{ inputs.release_type == 'Pre-Release' }}
- files: |
- release-assets/**/*.zip
- release-assets/**/*-boot*.img
|