-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (80 loc) · 2.95 KB
/
deploy.yml
File metadata and controls
90 lines (80 loc) · 2.95 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: deploy
on:
schedule:
- cron: "0 21 * * *" # daily
push:
branches: [master]
workflow_dispatch:
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Check out hugo encrypt
uses: actions/checkout@master
with:
repository: Izumiko/hugo-encrypt
path: 'hugo-encrypt'
- name: Build hugo encrypt
working-directory: ./hugo-encrypt
run: |
go mod tidy
go build
- name: Check out Hugo blog
uses: actions/checkout@v2
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
path: 'xzebra.github.io'
# Get also submodules
submodules: 'recursive'
- name: Retrieve posts from Notion
id: notion_blog
uses: xzebra/notion-blog@master
with:
database-id: '9338ce6af74241259bdb230a9da697cc'
content-folder: ./xzebra.github.io/content/blog
images-folder: ./xzebra.github.io/static/images/posts
images-link: /images/posts
archetype-file: ./xzebra.github.io/archetypes/blog.md
property-description: "Description"
property-tags: "Tags"
property-categories: "Categories"
filter-prop: 'Status'
filter-value: "Finished ✅,Published 🖨"
published-value: 'Published 🖨'
use-date-for-filename: false
use-shortcodes: true
env:
NOTION_SECRET : ${{ secrets.NOTION_SECRET }}
- name: Setup Hugo
if: ${{github.event_name != 'schedule' || steps.notion_blog.outputs.articles_published != '0'}}
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true
- name: Generate static content
if: ${{github.event_name != 'schedule' || steps.notion_blog.outputs.articles_published != '0'}}
working-directory: ./xzebra.github.io
run: |
hugo --minify -d public
- name: Encrypt required blog posts
if: ${{github.event_name != 'schedule' || steps.notion_blog.outputs.articles_published != '0'}}
working-directory: ./xzebra.github.io
run: |
../hugo-encrypt/hugo-encrypt -sitePath public > /dev/null 2>&1
- name: Deploy
if: ${{github.event_name != 'schedule' || steps.notion_blog.outputs.articles_published != '0'}}
uses: peaceiris/actions-gh-pages@v3.7.0-8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./xzebra.github.io/public
# need to exclude .gitignore as actions-gh-pages wont deploy
# ignored files
exclude_assets: '.github,**/.gitignore'
force_orphan: true