Skip to content

Commit 9c8d7cb

Browse files
authored
Create main.yml
1 parent a4e03e9 commit 9c8d7cb

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # 或者 master,取决于你的主分支名称
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install Dependencies
25+
run: npm ci
26+
27+
- name: Build
28+
run: npm run build-only
29+
30+
- name: Deploy to GitHub Pages
31+
uses: JamesIves/github-pages-deploy-action@v4
32+
with:
33+
folder: dist # Vite 构建输出目录
34+
branch: gh-pages # 部署分支

0 commit comments

Comments
 (0)