generated from postyizhan/Wiki-Template
-
Notifications
You must be signed in to change notification settings - Fork 54
47 lines (42 loc) · 993 Bytes
/
wiki-deploy.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
name: Wiki Deploy
# 触发条件
on:
push:
branches: [ 'main' ]
paths:
- 'docs/**'
- 'package.json'
# 设置权限
permissions:
contents: write
# 环境变量
env:
BASE_URL: NitWikit
# 任务
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
# 启用缓存加速部署
- name: Cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# 安装 Npm 并构建
- name: Install and Build
run: npm install && npm run build
# 部署
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build