Skip to content

Commit c4d794f

Browse files
frant1cfrant1c
authored andcommitted
fix
1 parent ccc4e64 commit c4d794f

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,44 @@ on:
55
branches: [main]
66

77
permissions:
8-
contents: write # 添加写入权限
8+
contents: read
9+
pages: write
10+
id-token: write
911

1012
jobs:
11-
build-and-deploy:
13+
build:
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Checkout
15-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1618

1719
- name: Setup Node.js
18-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
1921
with:
2022
node-version: "18"
2123
cache: "npm"
2224

2325
- name: Install dependencies
24-
run: npm install
26+
run: npm ci
2527

2628
- name: Build project
2729
run: npm run build
2830

29-
- name: Setup GitHub Pages
30-
run: |
31-
touch dist/.nojekyll
32-
cp dist/index.html dist/404.html 2>/dev/null || true
31+
- name: Setup Pages
32+
uses: actions/configure-pages@v3
3333

34-
- name: Deploy to GitHub Pages
35-
uses: peaceiris/actions-gh-pages@v3
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v2
3636
with:
37-
github_token: ${{ secrets.GITHUB_TOKEN }}
38-
publish_dir: ./dist
39-
user_name: "github-actions[bot]"
40-
user_email: "github-actions[bot]@users.noreply.github.com"
37+
path: ./dist
38+
39+
deploy:
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
runs-on: ubuntu-latest
44+
needs: build
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)