-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 1.47 KB
/
deploy.yml
File metadata and controls
67 lines (54 loc) · 1.47 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
name: 部署到 GitHub Pages
on:
# 在推送到 main 分支时触发
push:
branches: [ "main" ]
# 允许手动触发工作流
workflow_dispatch:
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# 只允许一个并发部署,跳过正在运行和最新排队之间的运行
# 但是,不要取消正在进行的运行,因为我们希望让这些生产部署完成
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# 构建作业
build:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 设置 Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: 安装依赖
run: npm ci
- name: 运行代码检查
run: npm run lint
- name: 运行测试
run: npm run test:run
- name: 构建项目
run: npm run build
- name: 设置 Pages
uses: actions/configure-pages@v5
- name: 上传构建产物
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
# 部署作业
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: 部署到 GitHub Pages
id: deployment
uses: actions/deploy-pages@v4