| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- name: get kernel version before cloning
- description: get kernel version before cloning
- runs:
- using: composite
- steps:
- - name: Locate and extract version metadata
- shell: bash
- run: |
- TARGET_FILE="build.config.constants"
- REPO="WildKernels/Samsung_Kernels"
- echo "Searching for $TARGET_FILE on branch $BRANCH"
- # Get repository tree without cloning
- TREE_URL="https://api.github.com/repos/$REPO/git/trees/$BRANCH?recursive=1"
- FILE_PATH=$(curl -s "$TREE_URL" | \
- jq -r '.tree[].path' | \
- grep "/$TARGET_FILE$" | \
- head -n 1)
- if [ -z "$FILE_PATH" ]; then
- echo "::error::Could not find $TARGET_FILE"
- exit 1
- fi
- echo "Found: $FILE_PATH"
- # Download only the file
- RAW_URL="https://raw.githubusercontent.com/$REPO/$BRANCH/$FILE_PATH"
- FILE_CONTENT=$(curl -s "$RAW_URL")
- BRANCH_LINE=$(echo "$FILE_CONTENT" | grep "^BRANCH=" | head -n 1)
- if [ -z "$BRANCH_LINE" ]; then
- echo "::error::BRANCH= not found"
- exit 1
- fi
- # Extract versions
- VERSION=${BRANCH_LINE#*=}
- ANDROID_VERSION=${VERSION%-*}
- KERNEL_VERSION=${VERSION##*-}
- echo "Android: $ANDROID_VERSION"
- echo "Kernel: $KERNEL_VERSION"
- echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV"
- echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"
|