Skip to content

Check Update

Check Update #2205

Workflow file for this run

name: Check Update
on:
workflow_dispatch:
schedule:
- cron: '15 9,21 * * *'
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }}
- name: Setup ssh agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }}
- name: Check update
run: |
git config --global user.email "[email protected]"
git config --global user.name "sdvcrx-bot"
DOCKER_TAG=$(grep 'ENV' Dockerfile | cut -d ' ' -f 3)
LATEST_TAG=$(curl -m 10 --retry 5 --silent "https://api.github.com/repos/gohugoio/hugo/releases" | jq -r '.[0].tag_name' | cut -d 'v' -f 2)
if [ "$DOCKER_TAG" = "$LATEST_TAG" ]; then echo "latest tag is same => $DOCKER_TAG" && exit 0; fi
sed -i "s|$DOCKER_TAG|$LATEST_TAG|g" Dockerfile
git add Dockerfile && git commit -m "Update hugo to v$LATEST_TAG"
git tag -a "$LATEST_TAG" -m "$LATEST_TAG"
git push && git push --tags