-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.06 KB
/
Hexo Pages.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
name: Blog CI/CD
# 触发条件:在 push 到 hexo-blog-backup 分支后触发
on:
push:
branches: main
jobs:
build:
runs-on: ubuntu-latest # 使用最新的 Ubuntu 系统作为编译部署的环境
permissions:
contents: write
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Use Node.js Latest
# 设置 node.js 环境
uses: actions/setup-node@v3
with:
node-version: latest
- name: Cache node modules
# 设置包缓存目录,避免每次下载
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install hexo dependencies
# 安装 hexo
run: npm install
- name: Build
# 编译 markdown 文件
run: npm run build
- name: Deploy hexo blog
# 将编译后的博客文件推送到指定仓库
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public