-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (63 loc) · 1.58 KB
/
deploy.yml
File metadata and controls
77 lines (63 loc) · 1.58 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
68
69
70
71
72
73
74
75
76
77
name: 部署到 GitHub Pages
on:
# 推送到 main 分支时触发
push:
branches: [ main ]
# 手动触发
workflow_dispatch:
# 设置 GITHUB_TOKEN 权限
permissions:
contents: read
pages: write
id-token: write
# 只允许一个并发部署,跳过正在进行的运行之间排队的运行
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# 构建作业
build:
name: 构建
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 设置 Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: 缓存 Bun 依赖
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: 安装依赖
run: bun install
- name: 运行测试
run: bun test
- name: 代码检查
run: bun lint
- name: 构建项目
run: bun run build:gh-pages
env:
NODE_ENV: production
- name: 设置 Pages
uses: actions/configure-pages@v4
- name: 上传构建产物
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
# 部署作业
deploy:
name: 部署
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