Skip to content

Commit 2fb53fd

Browse files
author
SoftOSDev
committed
actions
1 parent 31034ac commit 2fb53fd

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# 文件路径:.github/workflows/deploy.yml
1+
# .github/workflows/deploy.yml
22
name: Deploy to GitHub Pages
33

44
on:
55
push:
6-
branches: [master] # 确保与你的分支名一致(main 或 master)
6+
branches: [master]
77

88
workflow_dispatch:
99

@@ -27,21 +27,23 @@ jobs:
2727
uses: actions/setup-node@v4
2828
with:
2929
node-version: '20'
30-
cache: 'pnpm' # 启用 pnpm 缓存
30+
cache: 'pnpm'
3131

32-
- name: Install pnpm
33-
run: npm install -g pnpm
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v3
34+
with:
35+
version: 9 # 或 latest
3436

3537
- name: Install dependencies
36-
run: pnpm install # 使用 pnpm 安装依赖
38+
run: pnpm install
3739

3840
- name: Build project
39-
run: pnpm run build # 调用 package.json 中的 "build" 脚本
41+
run: pnpm run build
4042

4143
- name: Upload artifact
4244
uses: actions/upload-pages-artifact@v3
4345
with:
44-
path: dist # vite build 默认输出到 dist 目录
46+
path: dist
4547

4648
deploy:
4749
needs: build
@@ -51,5 +53,4 @@ jobs:
5153
url: ${{ steps.deployment.outputs.page_url }}
5254
steps:
5355
- name: Deploy to GitHub Pages
54-
id: deployment
5556
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)