action.yml 2.8 KB

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