-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (28 loc) · 1.11 KB
/
check-update.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }}
- name: Check update
run: |
git config --global user.email "memory.silentvoyage@gmail.com"
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