This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (85 loc) · 3.65 KB
/
track.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 }}