-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (43 loc) · 1.16 KB
/
main.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Github Pages
on:
push:
branches:
- master
schedule:
- cron: '1 */1 * * *'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Hong_Kong
- name: Checkout
uses: actions/checkout@v3
- name: Nested checkout branch
uses: actions/checkout@v3
with:
ref: gh-pages
path: public
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.91.2'
- name: Build
run: hugo
- name: Check Changes
working-directory: ./public
run: |
CHANGES="$(git diff -U0 --word-diff|grep @@|wc -l)"
UPDATED="$(git diff -U0 --word-diff|grep updated|wc -l)"
if [ "$CHANGES" = "1" ] && [ "$UPDATED" = "1" ]; then
git checkout .
fi
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
full_commit_message: ${{ github.event.head_commit.message }}