-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (51 loc) · 1.52 KB
/
gh-pages.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: github pages
on:
push:
branches:
- main # Set a branch to deploy
schedule:
- cron: '0,30 8-10 * * *'
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Copy Configuration
run: cp ./config.yaml.example ./config.yaml
- name: Build
run: go build
- name: Fetch latest
id: fetch_latest
run: |
echo "::set-output name=ERR_MSG::$(./news latest | grep -c 'error')"
- name: Cache pages
# if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
run: ./news cache
- name: Update database
if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
uses: test-room-7/action-update-file@v1
with:
file-path: data/news.db
committer-name: wenkechen
committer-email: ${{ secrets.COMMITTER_EMAIL }}
commit-msg: Update database
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
# if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./cache