-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (46 loc) · 1.63 KB
/
deploy-2-page.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
name: CI - build and test on gh-pages
# 在 push 时触发
on:
push:
branches:
- '*'
- '!gh-pages'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache Hugo resources
uses: actions/cache@v2
env:
cache-name: cache-hugo-resources
with:
path: resources
key: ${{ env.cache-name }}
- uses: actions/setup-go@v2
with:
go-version: "^1.19.1" # 设定 Go 的版本
- run: go version
- name: Cache Go Modules # 当前的模板依赖于这样的更新方式
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: Setup Hugo ✨ # 使用最新版本的扩展版 Hugo 构建
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
extended: true
- name: Hugo Build 🛠️
run: hugo --minify --gc
- name: Deploy to gh-pages 🚀 # gh-pages 用于测试目的,同时也是 staging 环境
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: public
clean: true
single-commit: true