112 lines
No EOL
3.8 KiB
YAML
112 lines
No EOL
3.8 KiB
YAML
name: Version Check
|
|
on:
|
|
repository_dispatch:
|
|
types: [webhook-event]
|
|
|
|
concurrency:
|
|
group: delayed-version-check
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
version-search:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
versions: ${{ steps.search.outputs.versions }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Download latest loaderspot_cli_linux_x64
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
gh release download --repo ${{ github.repository }} --pattern "loaderspot-cli-linux-x64" --output loaderspot_cli
|
|
chmod +x loaderspot_cli
|
|
|
|
- name: Version search
|
|
id: search
|
|
if: github.event.client_payload.v && github.event.client_payload.s
|
|
env:
|
|
v: ${{ github.event.client_payload.v }}
|
|
s: ${{ github.event.client_payload.s }}
|
|
run: |
|
|
{
|
|
echo 'versions<<EOF'
|
|
./loaderspot_cli --version "$v" --connections 300 --ladder-search
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
get-build-type:
|
|
runs-on: windows-latest
|
|
needs: version-search
|
|
if: success() && needs.version-search.outputs.versions
|
|
continue-on-error: true
|
|
outputs:
|
|
build_type: ${{ steps.get_build_type.outputs.build_type }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Get Win64 URL and determine build type
|
|
id: get_build_type
|
|
shell: pwsh
|
|
run: |
|
|
$versionsJson = '${{ needs.version-search.outputs.versions }}' | ConvertFrom-Json
|
|
$win64Url = $versionsJson.WIN64
|
|
if ($win64Url) {
|
|
./get-build-info.ps1 -Url $win64Url
|
|
} else {
|
|
"build_type=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
}
|
|
|
|
send-to-gas:
|
|
runs-on: ubuntu-latest
|
|
needs: [version-search, get-build-type]
|
|
if: success() && needs.version-search.outputs.versions
|
|
steps:
|
|
- name: Send data to Google Apps Script
|
|
env:
|
|
g: ${{ secrets.GOOGLE_APPS_URL }}
|
|
versions: ${{ needs.version-search.outputs.versions }}
|
|
build_type: ${{ needs.get-build-type.outputs.build_type }}
|
|
source: ${{ github.event.client_payload.s }}
|
|
run: |
|
|
if [ -z "$versions" ]; then
|
|
echo "Versions data is empty. Skipping."
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$build_type" = "false" ]; then
|
|
final_json=$(echo "$versions" | jq \
|
|
--argjson buildType false \
|
|
--arg source "$source" \
|
|
'. + {buildType: $buildType, source: $source}')
|
|
else
|
|
final_json=$(echo "$versions" | jq \
|
|
--arg buildType "$build_type" \
|
|
--arg source "$source" \
|
|
'. + {buildType: $buildType, source: $source}')
|
|
fi
|
|
|
|
echo "Отправка данных на GAS..."
|
|
|
|
# Показываем все редиректы
|
|
echo "Отладка редиректов:"
|
|
curl -v -L -X POST "$g" \
|
|
-H "Content-Type: application/json" \
|
|
--data-raw "$final_json" 2>&1 | grep -E "(< HTTP|< Location:)" || true
|
|
|
|
echo ""
|
|
echo "Финальный ответ:"
|
|
|
|
# Делаем реальный запрос
|
|
response=$(curl -s --location-trusted -X POST "$g" \
|
|
-H "Content-Type: application/json" \
|
|
--data-raw "$final_json")
|
|
|
|
if echo "$response" | grep -q "<!DOCTYPE html>"; then
|
|
echo "Получен HTML ответ"
|
|
echo "Проверьте сообщение в Telegram - если оно пришло, значит скрипт работает"
|
|
else
|
|
echo "Ответ от GAS: $response"
|
|
fi |