action.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Setup Wild KSU
  2. description: Download and configure Wild KSU with version tracking
  3. inputs:
  4. ksu_branch:
  5. description: 'KernelSU branch or commit (empty = latest dev-susfs branch tip)'
  6. required: false
  7. default: ""
  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/pershoot/KernelSU-Next.git"
  17. KSU_INPUT="${{ inputs.ksu_branch }}"
  18. if [ -z "$KSU_INPUT" ]; then
  19. KSU_INPUT="dev-susfs"
  20. fi
  21. # Try as branch first, fall back to commit
  22. if git ls-remote --heads "$KSU_REPO" "$KSU_INPUT" | grep -q .; then
  23. echo "Using KernelSU-Next branch: $KSU_INPUT"
  24. curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
  25. git -C KernelSU-Next/kernel fetch --depth=50 origin "$KSU_INPUT"
  26. git -C KernelSU-Next/kernel checkout "origin/$KSU_INPUT"
  27. else
  28. echo "Using KernelSU-Next commit: $KSU_INPUT"
  29. curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/dev-susfs/kernel/setup.sh" | bash -s dev-susfs
  30. git -C KernelSU-Next/kernel fetch --depth=50 origin "$KSU_INPUT"
  31. git -C KernelSU-Next/kernel checkout "$KSU_INPUT"
  32. fi
  33. cd KernelSU-Next/kernel
  34. COMMITS_COUNT=$(/usr/bin/git rev-list --count HEAD)
  35. BASE_VERSION=30000
  36. KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
  37. sed -i "s/^KSU_VERSION_FALLBACK := 1$/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" Kbuild
  38. KSU_GIT_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")"
  39. sed -i "s/^KSU_VERSION_TAG_FALLBACK := v0.0.1$/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" Kbuild
  40. - name: Extract KSU Version Info
  41. id: ksu-version
  42. shell: bash
  43. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  44. run: |
  45. # Fetch dev branch for version info (tags, commits, etc.)
  46. git fetch --depth=50 origin dev 2>/dev/null || true
  47. # Extract and export KSU version info from dev branch
  48. KSU_GIT_VERSION=$(git rev-list --count origin/dev 2>/dev/null)
  49. KSU_GIT_TAG=$(git describe --tags --abbrev=0 origin/dev 2>/dev/null || echo "")
  50. KSU_COMMIT=$(git rev-parse --short origin/dev 2>/dev/null)
  51. KSU_VERSION=$((30000 + KSU_GIT_VERSION))
  52. echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  53. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  54. echo "KSU_COMMIT=$KSU_COMMIT" >> $GITHUB_ENV
  55. - name: 'Fix KernelSU-Next'
  56. shell: bash
  57. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  58. run: |
  59. set -euo pipefail
  60. cp ${{ github.action_path }}/patches/static.patch "${{ github.workspace }}/kernel/KernelSU-Next/static.patch"
  61. patch -p1 < static.patch
  62. - name: Enable Kernel Configs
  63. uses: ./.github/actions/set-kernel-config
  64. with:
  65. config_list: |
  66. CONFIG_KSU=y