-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (55 loc) · 1.69 KB
/
notion.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
52
53
54
55
name: notion
on:
workflow_dispatch:
jobs:
sync:
name: Sync from notion
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Clean the old post
# Add a random number file to avoid git commit error
run: |
rm -rf ./content/*
mkdir -p ./content
touch ./content/temp-"$RANDOM".md
- name: notion-site
uses: nonacosa/notion-site@master
env:
NOTION_SECRET : ${{ secrets.NOTION_SECRET }}
- name: Commit files
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
git add --all
git commit -m "New results"
git pull origin main
git push
- name: Format documents
uses: creyD/[email protected]
with:
commit_message: 'notion-md-gen: update articles (auto)'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
#hugo-version: 'latest'
hugo-version: '0.132.2'
extended: true
- uses: actions/cache@v4
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public