Skip to content

Commit 7736afd

Browse files
committed
重构GitHub Pages部署工作流
1 parent c352846 commit 7736afd

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,48 @@ on:
55
branches: [ main ]
66
workflow_dispatch:
77

8+
# 设置GITHUB_TOKEN的权限
89
permissions:
910
contents: read
1011
pages: write
1112
id-token: write
1213

14+
# 允许一个并发部署
1315
concurrency:
1416
group: "pages"
1517
cancel-in-progress: false
1618

1719
jobs:
18-
build:
20+
# 单个部署工作流
21+
build-and-deploy:
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
1925
runs-on: ubuntu-latest
2026
steps:
2127
- name: Checkout
2228
uses: actions/checkout@v4
29+
2330
- name: Setup Node
2431
uses: actions/setup-node@v4
2532
with:
2633
node-version: "18"
2734
cache: 'npm'
35+
36+
- name: Setup Pages
37+
uses: actions/configure-pages@v4
38+
2839
- name: Install dependencies
2940
run: npm ci
41+
3042
- name: Build
3143
run: npm run build
44+
3245
- name: Upload artifact
3346
uses: actions/upload-pages-artifact@v3
3447
with:
3548
path: ./out
36-
37-
deploy:
38-
environment:
39-
name: github-pages
40-
url: ${{ steps.deployment.outputs.page_url }}
41-
runs-on: ubuntu-latest
42-
needs: build
43-
steps:
49+
4450
- name: Deploy to GitHub Pages
4551
id: deployment
46-
uses: actions/deploy-pages@v3
52+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)