forked from AlanDecode/Blog-With-GitHub-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 1.43 KB
/
ci.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
56
57
58
59
60
61
62
63
64
65
66
67
name: Build
on:
push:
branches:
- source
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Init submodule
run: |
git submodule update --init --recursive
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
cd ./Maverick
python -m pip install --upgrade pip
pip install -r prod_req.txt
# Get build cache
- uses: actions/checkout@v2
with:
ref: 'cache'
path: './build_cache'
- name: Build site
run: |
# 复用图片解析缓存
mkdir ./Maverick/cached_imgs
cp ./build_cache/sizeinfo.json ./Maverick/cached_imgs
rm -rf ./build_cache/.git
cd ./Maverick
python ./build.py -c "../conf.py"
# 保存图片缓存
cd ..
cp ./Maverick/cached_imgs/sizeinfo.json ./build_cache
- name: Deploy to GitHub Pages
uses: docker://peaceiris/gh-pages:v2
env:
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PUBLISH_BRANCH: master
PUBLISH_DIR: ./dist
with:
emptyCommits: false
- name: Save build cache
uses: docker://peaceiris/gh-pages:v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: cache
PUBLISH_DIR: ./build_cache
with:
emptyCommits: false