Skip to content

Commit 2a37c08

Browse files
committed
fix: 更新GitHub Action配置,升级Node.js到18,添加权限设置
1 parent c34a582 commit 2a37c08

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches:
6-
- main # 每次推送到main分支时触发
6+
- main
7+
8+
# 设置 GITHUB_TOKEN 的权限
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
713

814
jobs:
915
build-and-deploy:
1016
runs-on: ubuntu-latest
1117

1218
steps:
1319
- name: Checkout code
14-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
1521

1622
- name: Setup Node.js
17-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
1824
with:
19-
node-version: '16'
25+
node-version: '18'
2026
cache: 'npm'
2127

2228
- name: Install dependencies
@@ -25,11 +31,11 @@ jobs:
2531
- name: Build project
2632
run: npm run build
2733
env:
28-
CI: false # 允许有警告的情况下继续构建
34+
CI: false
2935

3036
- name: Deploy to GitHub Pages
3137
uses: JamesIves/github-pages-deploy-action@v4
3238
with:
33-
folder: build # 构建输出的文件夹
34-
branch: gh-pages # 部署的目标分支
35-
clean: true # 清理旧文件
39+
folder: build
40+
branch: gh-pages
41+
clean: true

0 commit comments

Comments
 (0)