-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.1 KB
/
cf.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
name: 部署到 Cloudflare Pages
on:
push:
branches:
- 'main' # 当推送到 main 分支时触发
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 第一步:检出代码
- name: 检出代码
uses: actions/checkout@v3
# 第二步:安装 pnpm
- name: 安装 pnpm
uses: pnpm/action-setup@v3
with:
version: latest
# 第三步:安装依赖
- name: 安装依赖
run: pnpm install
# 第四步:构建项目
- name: 构建项目
run: pnpm run docs:build
# 第五步:安装 Wrangler
- name: 安装 Wrangler
run: pnpm add -g wrangler@3
# 第六步:发布到 Cloudflare Pages
- name: 发布到 Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} # Cloudflare Pages API Token
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} # Cloudflare 账户 ID
projectName: study-wiki # Cloudflare Pages 项目名称
directory: docs/.vitepress/dist # 构建输出目录