action.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: Extract KSU Version Info
  37. id: ksu-version
  38. shell: bash
  39. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  40. run: |
  41. # Extract and export KSU version info
  42. KSU_GIT_VERSION=$(git rev-list --count HEAD 2>/dev/null)
  43. KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
  44. KSU_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
  45. KSU_VERSION=$((30000 + KSU_GIT_VERSION))
  46. echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  47. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  48. echo "KSU_COMMIT=$KSU_COMMIT" >> $GITHUB_ENV
  49. - name: 'Fix KernelSU-Next'
  50. shell: bash
  51. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  52. run: |
  53. set -euo pipefail
  54. cp ${{ github.action_path }}/patches/static.patch "${{ github.workspace }}/kernel/KernelSU-Next/static.patch"
  55. patch -p1 < static.patch
  56. - name: Enable Kernel Configs
  57. uses: ./.github/actions/set-kernel-config
  58. with:
  59. configs: |
  60. CONFIG_KSU