action.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: get kernel version before cloning
  2. description: get kernel version before cloning
  3. runs:
  4. using: composite
  5. steps:
  6. - name: Locate and extract kernel version
  7. shell: bash
  8. run: |
  9. REPO="WildKernels/Samsung_Kernels"
  10. echo "Searching for root Makefile on branch $BRANCH"
  11. # Get repository tree without cloning
  12. TREE_URL="https://api.github.com/repos/$REPO/git/trees/$BRANCH?recursive=1"
  13. MAKEFILES=$(curl -s "$TREE_URL" | jq -r '.tree[].path' | grep 'Makefile$')
  14. for file in $MAKEFILES; do
  15. CONTENT=$(curl -s "https://raw.githubusercontent.com/$REPO/$BRANCH/$file")
  16. if echo "$CONTENT" | grep -q '^VERSION[[:space:]]*='; then
  17. MAKEFILE_PATH="$file"
  18. break
  19. fi
  20. done
  21. if [ -z "$MAKEFILE_PATH" ]; then
  22. echo "::error::Could not find kernel Makefile"
  23. exit 1
  24. fi
  25. echo "Found kernel Makefile: $MAKEFILE_PATH"
  26. # Download only the Makefile
  27. RAW_URL="https://raw.githubusercontent.com/$REPO/$BRANCH/$MAKEFILE_PATH"
  28. MAKEFILE_CONTENT=$(curl -s "$RAW_URL")
  29. VERSION=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^VERSION[[:space:]]*=' | awk '{print $3}')
  30. PATCHLEVEL=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^PATCHLEVEL[[:space:]]*=' | awk '{print $3}')
  31. if [ -z "$VERSION" ] || [ -z "$PATCHLEVEL" ]; then
  32. echo "::error::Could not extract kernel version from Makefile"
  33. exit 1
  34. fi
  35. KERNEL_VERSION="$VERSION.$PATCHLEVEL"
  36. if [ "$KERNEL_VERSION" = "5.10" ]; then
  37. ANDROID_VERSION="android12"
  38. elif [ "$KERNEL_VERSION" = "5.15" ]; then
  39. ANDROID_VERSION="android13"
  40. elif [ "$KERNEL_VERSION" = "6.1" ]; then
  41. ANDROID_VERSION="android14"
  42. elif [ "$KERNEL_VERSION" = "6.6" ]; then
  43. ANDROID_VERSION="android15"
  44. else
  45. ANDROID_VERSION="unknown"
  46. fi
  47. echo "Android: $ANDROID_VERSION"
  48. echo "Kernel: $KERNEL_VERSION"
  49. echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV"
  50. echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"