alaskartv-api/watchTV.sh

29 lines
891 B
Bash
Raw Permalink Normal View History

2024-12-20 16:33:09 +00:00
#!/bin/sh
if [ -f .botenv ]; then
export $(grep -v '^#' .botenv | xargs)
fi
LAST_RELEASE_FILE=/data/alaskartv/androidtv-ci/release.txt
latest_release=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | jq -r '.tag_name')
2024-12-30 02:12:11 +00:00
echo "Latest Release: '$latest_release'"
2024-12-20 16:47:44 +00:00
if [ -f "$LAST_RELEASE_FILE" ]; then
read -r version < "$LAST_RELEASE_FILE"
else
version=""
fi
2024-12-30 02:12:11 +00:00
echo "Current Version: '$version'"
echo "Comparison result: $latest_release != $version"
2024-12-20 16:47:44 +00:00
if [ "$latest_release" != "$version" ]; then
2024-12-30 02:12:11 +00:00
echo "Versions are different, updating..."
curl -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" \
-d chat_id="$CHAT_ID" \
-d text="🚀 New Release Detected: $latest_release on $REPO_OWNER/$REPO_NAME"
curl -X POST "http://api-server:9090/api/alaskartv"
else
echo "Versions are the same, no update needed"
fi