-
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.44 KB
/
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
48
49
50
51
52
53
name: Deploy playground demo # 工作流的名称
on: # 触发条件
push:
branches:
- main # 当 main 分支收到推送时触发
workflow_dispatch: # 允许手动触发
permissions: # GitHub token 的权限设置
contents: read # 读取仓库内容
pages: write # 写入 GitHub Pages
id-token: write # 写入身份令牌
concurrency: # 并发控制
group: pages # 同一时间只允许一个部署任务运行
cancel-in-progress: true # 如果有新的部署,取消正在进行的部署
jobs:
deploy:
environment: # 环境配置
name: github-pages # 环境名称
url: ${{ steps.deployment.outputs.page_url }} # 部署后的 URL
runs-on: ubuntu-latest # 运行环境
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
- run: pnpm playground:build
# 添加缓存验证步骤
- name: Verify build
run: |
if [ ! -d "playground/dist" ]; then
echo "Playground build failed - dist directory not found"
exit 1
fi
- uses: actions/configure-pages@v5
with:
enablement: true
- uses: actions/upload-pages-artifact@v3
with:
path: playground/dist # 指定要部署的目录
- uses: actions/deploy-pages@v4
id: deployment