Skip to content

Commit 36140f6

Browse files
author
SoftOSDev
committed
%1
1 parent d93557d commit 36140f6

File tree

4 files changed

+2909
-33
lines changed

4 files changed

+2909
-33
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,55 @@
1-
#
2-
name: Deploy Vue site to Pages
1+
# 文件路径:.github/workflows/deploy.yml
2+
name: Deploy to GitHub Pages
33

44
on:
5-
# 在针对 `main` 分支的推送上运行。如果你
6-
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
75
push:
8-
branches: [master]
6+
branches: [main] # 确保与你的分支名一致(main 或 master)
97

10-
# 允许你从 Actions 选项卡手动运行此工作流程
118
workflow_dispatch:
129

13-
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
1410
permissions:
1511
contents: read
1612
pages: write
1713
id-token: write
1814

19-
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
20-
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
2115
concurrency:
22-
group: pages
16+
group: github-pages
2317
cancel-in-progress: false
2418

2519
jobs:
26-
# 构建工作
2720
build:
2821
runs-on: ubuntu-latest
2922
steps:
3023
- name: Checkout
3124
uses: actions/checkout@v4
32-
with:
33-
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
34-
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消此区域注释
35-
# with:
36-
# version: 9
37-
- uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
38-
- name: Setup Node
25+
26+
- name: Setup Node.js
3927
uses: actions/setup-node@v4
4028
with:
41-
node-version: 22
42-
cache: npm # 或 pnpm / yarn
43-
- name: Setup Pages
44-
uses: actions/configure-pages@v4
29+
node-version: '20'
30+
cache: 'pnpm' # 启用 pnpm 缓存
31+
32+
- name: Install pnpm
33+
run: npm install -g pnpm
34+
4535
- name: Install dependencies
46-
run: pnpm install # 或 pnpm install / yarn install / bun install
47-
- name: Build with Vue
48-
run: bun run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
36+
run: pnpm install # 使用 pnpm 安装依赖
37+
38+
- name: Build project
39+
run: pnpm run build # 调用 package.json 中的 "build" 脚本
40+
4941
- name: Upload artifact
5042
uses: actions/upload-pages-artifact@v3
5143
with:
52-
path: dist
44+
path: dist # vite build 默认输出到 dist 目录
5345

54-
# 部署工作
5546
deploy:
47+
needs: build
48+
runs-on: ubuntu-latest
5649
environment:
5750
name: github-pages
5851
url: ${{ steps.deployment.outputs.page_url }}
59-
needs: build
60-
runs-on: ubuntu-latest
61-
name: Deploy
6252
steps:
6353
- name: Deploy to GitHub Pages
6454
id: deployment
65-
uses: actions/deploy-pages@v4
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dist-ssr
1414
coverage
1515
*.local
1616
push.cmd
17+
push.sh
1718

1819
/cypress/videos/
1920
/cypress/screenshots/

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"build-only": "vite build",
1111
"type-check": "vue-tsc --build",
1212
"format": "prettier --write src/",
13-
"deploy": "vite build && gh-pages -d dist"
13+
"deploy": "vite build && gh-pages -d dist",
14+
"lock": "pnpm install"
1415
},
1516
"dependencies": {
1617
"animate.css": "^4.1.1",
18+
"pnpm": "^10.14.0",
1719
"vue": "^3.5.18",
1820
"vue-router": "^4.5.1",
1921
"xml-js": "^1.6.11"
@@ -33,4 +35,4 @@
3335
"vite-plugin-vue-devtools": "^7.7.7",
3436
"vue-tsc": "^2.2.12"
3537
}
36-
}
38+
}

0 commit comments

Comments
 (0)