action.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. MAKEFILE_PATH=$(curl -s "$TREE_URL" | \
  14. jq -r '.tree[].path' | \
  15. grep 'Makefile$' | \
  16. head -n 1)
  17. if [ -z "$MAKEFILE_PATH" ]; then
  18. echo "::error::Could not find root Makefile"
  19. exit 1
  20. fi
  21. echo "Found: $MAKEFILE_PATH"
  22. # Download only the Makefile
  23. RAW_URL="https://raw.githubusercontent.com/$REPO/$BRANCH/$MAKEFILE_PATH"
  24. MAKEFILE_CONTENT=$(curl -s "$RAW_URL")
  25. VERSION=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^VERSION[[:space:]]*=' | awk '{print $3}')
  26. PATCHLEVEL=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^PATCHLEVEL[[:space:]]*=' | awk '{print $3}')
  27. if [ -z "$VERSION" ] || [ -z "$PATCHLEVEL" ]; then
  28. echo "::error::Could not extract kernel version from Makefile"
  29. exit 1
  30. fi
  31. KERNEL_VERSION="$VERSION.$PATCHLEVEL"
  32. if [ "$KERNEL_VERSION" = "5.10" ]; then
  33. ANDROID_VERSION="android12"
  34. elif [ "$KERNEL_VERSION" = "5.15" ]; then
  35. ANDROID_VERSION="android13"
  36. elif [ "$KERNEL_VERSION" = "6.1" ]; then
  37. ANDROID_VERSION="android14"
  38. elif [ "$KERNEL_VERSION" = "6.6" ]; then
  39. ANDROID_VERSION="android15"
  40. else
  41. ANDROID_VERSION="unknown"
  42. fi
  43. echo "Android: $ANDROID_VERSION"
  44. echo "Kernel: $KERNEL_VERSION"
  45. echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV"
  46. echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"