-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (115 loc) · 4.45 KB
/
ci.yml
File metadata and controls
143 lines (115 loc) · 4.45 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: hugo CI
on:
# schedule:
# - cron: '30 8 1-7 * 5' # 每月的第一个星期五,UTC 08:30(北京时间 16:30)触发
push: # push的时候触发
branches: # 那些分支需要触发
- main
jobs:
build:
runs-on: ubuntu-latest # 镜像市场
steps:
- name: checkout # 步骤的名称
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: clone git submodule
run: |
git submodule update --init --recursive
- name: 配置 search 搜索参数替换
uses: falnyr/replace-env-vars-action@master
env:
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
with:
filename: config.io/_default/params.zh-cn.toml
- name: 配置 comment 参数替换
uses: falnyr/replace-env-vars-action@master
env:
VALINE_ENABLE: ""
GITALK_ENABLE: true
GITALK_CLIENT_ID: ${{ secrets.GITALK_CLIENT_ID }}
GITALK_SECRET: ${{ secrets.GITALK_TOKEN }}
with:
filename: config.io/_default/params.toml
- name: 配置参数icp
uses: NicoG60/simple-template-renderer@v1
with:
input: config.io/_default/params.toml
env:
ICP: ""
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.146.0'
extended: true # 启用 extended
- name: Build
run: hugo --configDir config.io
- name: Build leetcode book
run: hugo --config book.leetcode.toml
- name: 复制 leetcode book 资源到 public
run: |
mkdir public/leetcode
cp -r public.book.leetcode/* public/leetcode
- name: Build wiki book
run: hugo --config book.wiki.toml
- name: 复制 wiki book 资源到 public
run: |
mkdir public/wiki
cp -r public.book.wiki/* public/wiki
- name: Build linux book
run: hugo --config book.linux.toml
- name: 复制 linux book 资源到 public
run: |
mkdir public/linux
cp -r public.book.linux/* public/linux
- name: Build english book
run: hugo --config=book.english.toml
- name: 复制 english book 资源到 public
run: |
mkdir public/english
cp -r public.book.english/* public/english
- name: Build kubernetes book
run: hugo --config book.kubernetes.toml
- name: 复制 kubernetes book 资源到 public
run: |
mkdir public/kubernetes
cp -r public.book.kubernetes/* public/kubernetes
# - name: Build ielts book
# run: hugo --config book.ielts.toml
#
# - name: 复制 ielts book 资源到 public
# run: |
# mkdir public/ielts
# cp -r public.book.ielts/* public/ielts
- name: Build http book
run: hugo --config book.http.toml
- name: 复制 http book 资源到 public
run: |
mkdir public/http
cp -r public.book.http/* public/http
- name: Build mrhh book
run: hugo --config book.mrhh.toml
- name: 复制 明日黄花 资源到 public
run: |
mkdir public/mrhh
cp -r public.book.mrhh/* public/mrhh
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.12' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: python 脚本,先删除索引再重新上传索引, gitalk issue init
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install --upgrade 'algoliasearch>=3.0,<4.0'
pip install --upgrade pip
python init-gitalk-issue.py ${{ secrets.TOKEN }} xiaobinqt xiaobinqt.github.io ${{ secrets.ALGOLIA_APP_ID }} ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.TOKEN }} # personal_token 这里新建一个 https://github.com/settings/tokens
PUBLISH_BRANCH: gh-pages # 推送到当前 gh-pages 分支
PUBLISH_DIR: ./public # hugo 生成到 public 作为跟目录
commit_message: ${{ github.event.head_commit.message }}