Skip to content

Latest version

Latest version #5

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
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