This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
Tracker #20818
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tracker | |
on: | |
push: | |
schedule: | |
- cron: '*/5 * * * *' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
actions: write | |
jobs: | |
track: | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Pull stored version | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
WindowsPlayer_guid | |
WindowsPlayer_ver | |
WindowsStudio64_guid | |
WindowsStudio64_ver | |
AndroidPlayer_guid | |
AndroidPlayer_ver | |
key: ${{ github.workflow }} | |
- name: Update pulled to upstream version | |
id: vercheck | |
run: | | |
csurl='https://clientsettings.roblox.com/v2/client-version/' | |
apkurl='https://web-api.aptoide.com/search?query=roblox' | |
retry() { until "$@"; do sleep 5; done; } | |
send_webhook() { curl -s -H "Content-Type: application/json" -X POST -d "{\"embeds\":[{${url:+\"url\": \"$url\",}${timestamp:+\"timestamp\": \"$timestamp\",}\"title\": \"[New Deployment] $b\",\"description\":\"\`\`\`diff\n${old_ver:+- $old_ver${old_guid:+ ($old_guid)}}\n+ $ver${guid:+ ($guid)}\n\`\`\`\",\"footer\":{\"text\": \"VinegarHQ\"}, \"color\": $1}]}" "$WEBHOOK"; } | |
save() { echo "$ver" > "${b}_ver"; echo "$guid" > "${b}_guid"; echo "hit=true" >> $GITHUB_OUTPUT; } | |
read_var() { [ ! -e "${b}_$1" ] || eval "read -r old_$1 < ${b}_$1"; } | |
for b in WindowsPlayer WindowsStudio64; do | |
out="$(retry curl -sf "$csurl/$b")"; err="${out##*message\":}" | |
[ "$err" = "$out" ] || { echo "$b: ${err%%\}*}" >&2; exit 1; } | |
ver="${out##*version\"\:\"}"; ver="${ver%%\"*}" | |
guid="${out##*"$ver"\"\,\"clientVersionUpload\"\:\"}"; guid="${guid%%\"*}" | |
read_var ver; read_var guid; echo "$b: GUIDs: $old_guid (cached), $guid (fetched)" | |
! [ "$old_guid" = "$guid" ] || continue | |
url="https://wholesale.vinegarhq.org/?guid=$guid&type=$b" | |
retry send_webhook 625103; save | |
done | |
unset ver old_ver guid old_guid url | |
b=AndroidPlayer | |
while IFS=: read -r k v; do [ "$v" ] || continue; case "$k" in | |
package) [ "$v" = com.roblox.client ] && inpkg=1 || unset inpkg ;; | |
updated) [ "$inpkg" ] || continue; y=${v%%\ *}; t=${v##*\ }; timestamp=${y}T${t}.000Z ;; | |
vername) [ "$inpkg" ] || continue; ver="$v" ;; | |
vercode) | |
[ "$inpkg" ] || continue; | |
read_var ver; read_var guid; guid="$v"; echo "$b: vercodes: $old_ver (cached), $ver (fetched)" | |
[ "$old_ver" = "$ver" ] || { send_webhook 10798649; save; }; break 2 | |
;; | |
esac; done <<-EOF | |
$(retry curl -sf "$apkurl" | tr '{}[],' '\n'| tr -d '"') | |
EOF | |
env: | |
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
# github.com/actions/cache/issues/342 | |
- name: Delete stored version | |
if: steps.vercheck.outputs.hit == 'true' | |
continue-on-error: true | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete "${{ github.workflow }}" --confirm | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload stored version | |
if: steps.vercheck.outputs.hit == 'true' | |
id: save-cache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
WindowsPlayer_guid | |
WindowsPlayer_ver | |
WindowsStudio64_guid | |
WindowsStudio64_ver | |
AndroidPlayer_guid | |
AndroidPlayer_ver | |
key: ${{ github.workflow }} |