name: Setup Wild KSU description: Download and configure Wild KSU with version tracking inputs: use_latest_commits: description: 'Use the latest commit on the branch instead of the pinned commit' required: false default: true runs: using: composite steps: - name: Download Wild KSU shell: bash working-directory: ${{ github.workspace }}/kernel run: | set -euo pipefail KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git" KSU_BRANCH="dev" if [ "${{ inputs.use_latest_commits }}" = "true" ]; then echo "Using latest KernelSU-Next from branch: $KSU_BRANCH" curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs else COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json" KSU_SETUP_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON") echo "Using pinned KernelSU commit: $KSU_SETUP_COMMIT" curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs git -C KernelSU-Next/kernel fetch --depth=50 origin "$KSU_SETUP_COMMIT" git -C KernelSU-Next/kernel checkout "$KSU_SETUP_COMMIT" fi cd KernelSU-Next/kernel COMMITS_COUNT=$(/usr/bin/git rev-list --count HEAD) BASE_VERSION=30000 KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION) sed -i "s/^KSU_VERSION_FALLBACK := 1$/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" Kbuild KSU_GIT_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")" sed -i "s/^KSU_VERSION_TAG_FALLBACK := v0.0.1$/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" Kbuild - name: Enable KernelSU Config shell: bash working-directory: ${{ github.workspace }}/kernel run: | cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF' # KernelSU Configuration CONFIG_KSU=y EOF - name: Extract KSU Version Info id: ksu-version shell: bash working-directory: ${{ github.workspace }}/kernel/KernelSU-Next run: | # Extract and export KSU version info KSU_GIT_VERSION=$(git rev-list --count HEAD 2>/dev/null) KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null) KSU_COMMIT=$(git rev-parse --short HEAD 2>/dev/null) KSU_VERSION=$((30000 + KSU_GIT_VERSION)) echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV echo "KSU_COMMIT=$KSU_COMMIT" >> $GITHUB_ENV