Skip to content

Latest version

Latest version #51

Workflow file for this run

name: Latest version
on:
schedule:
- cron: "0 18 * * *" # scheduled at 06:00 (UTC+8) everyday
workflow_dispatch:
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v4
- name: Fetch package.json from original repo
run: |
curl -o remote-package.json \
https://raw.githubusercontent.com/sglkc/hoyolab-auto-daily/master/package.json
- name: Compare versions
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
LOCAL_VERSION=$(jq -r .version package.json)
REMOTE_VERSION=$(jq -r .version remote-package.json)
echo "Local version: $LOCAL_VERSION"
echo "Remote version: $REMOTE_VERSION"
if [ "$(printf '%s\n' "$REMOTE_VERSION" "$LOCAL_VERSION" | sort -V | head -n1)" != "$REMOTE_VERSION" ]; then
echo "Repository version is outdated. Do sync your fork!"
if [ ! -z "$DISCORD_WEBHOOK" ]; then
curl -H "Content-Type: application/json" \
-d '{"content": "(INFO) New version released. Your repository is outdated."}' \
$DISCORD_WEBHOOK
fi
exit 1
fi