Skip to content

Latest version

Latest version #1

Workflow file for this run

name: Check latest version
on:
schedule:
- cron: "0 18 * * *" # scheduled at 06:00 (UTC+8) everyday
workflow_dispatch:
jobs:
check-in:
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
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 "Local version is lower than remote version. Sync your repo!"
exit 1
else
echo "Local version is up to date."
fi