action.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: Setup Wild KSU
  2. description: Download and configure Wild KSU with version tracking
  3. inputs:
  4. use_latest_commits:
  5. description: 'Use the latest commit on the branch instead of the pinned commit'
  6. required: false
  7. default: true
  8. runs:
  9. using: composite
  10. steps:
  11. - name: Download Wild KSU
  12. shell: bash
  13. working-directory: ${{ github.workspace }}/kernel
  14. run: |
  15. set -euo pipefail
  16. KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git"
  17. KSU_BRANCH="dev"
  18. if [ "${{ inputs.use_latest_commits }}" = "true" ]; then
  19. echo "Using latest KernelSU-Next from branch: $KSU_BRANCH"
  20. curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
  21. else
  22. COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
  23. KSU_SETUP_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON")
  24. echo "Using pinned KernelSU commit: $KSU_SETUP_COMMIT"
  25. curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
  26. git -C KernelSU-Next/kernel fetch --depth=50 origin "$KSU_SETUP_COMMIT"
  27. git -C KernelSU-Next/kernel checkout "$KSU_SETUP_COMMIT"
  28. fi
  29. cd KernelSU-Next/kernel
  30. COMMITS_COUNT=$(/usr/bin/git rev-list --count HEAD)
  31. BASE_VERSION=30000
  32. KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
  33. sed -i "s/^KSU_VERSION_FALLBACK := 1$/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" Kbuild
  34. KSU_GIT_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")"
  35. sed -i "s/^KSU_VERSION_TAG_FALLBACK := v0.0.1$/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" Kbuild
  36. - name: Enable KernelSU Config
  37. shell: bash
  38. working-directory: ${{ github.workspace }}/kernel
  39. run: |
  40. cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF'
  41. # KernelSU Configuration
  42. CONFIG_KSU=y
  43. EOF
  44. - name: Extract KSU Version Info
  45. id: ksu-version
  46. shell: bash
  47. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  48. run: |
  49. # Extract and export KSU version info
  50. KSU_GIT_VERSION=$(git rev-list --count HEAD 2>/dev/null)
  51. KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
  52. KSU_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
  53. KSU_VERSION=$((30000 + KSU_GIT_VERSION))
  54. echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  55. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  56. echo "KSU_COMMIT=$KSU_COMMIT" >> $GITHUB_ENV