Skip to content

Commit 955ae60

Browse files
committed
ci(workflow): 更新GitHub Actions部署配置以使用新页面部署流程
- 将工作流名称更新为"Deploy Docusaurus to GitHub Pages (Actions)" - 添加必要的权限配置(contents: read, pages: write, id-token: write) - 将单一job拆分为build和deploy两个独立job - 使用actions/upload-pages-artifact和actions/deploy-pages新API - 更新checkout action至v4版本 - 部署过程现在通过环境变量管理页面URL
1 parent ff4e2a9 commit 955ae60

3 files changed

Lines changed: 2426 additions & 2173 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Deploy Docusaurus Github pages
1+
name: Deploy Docusaurus to GitHub Pages (Actions)
2+
23
on:
34
push:
45
branches:
@@ -8,14 +9,17 @@ concurrency:
89
group: deploy-site
910
cancel-in-progress: true
1011

12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
1117
jobs:
12-
build-and-deploy:
18+
build:
1319
runs-on: ubuntu-latest
1420
steps:
1521
- name: Checkout
16-
uses: actions/checkout@main
17-
with:
18-
persist-credentials: false
22+
uses: actions/checkout@v4
1923

2024
- name: Set up pnpm
2125
run: corepack enable pnpm
@@ -29,17 +33,24 @@ jobs:
2933
- name: Install and Build
3034
run: |
3135
corepack enable
32-
pnpm install
36+
pnpm install --frozen-lockfile
3337
pnpm run build
3438
35-
- name: CNAME
36-
run: |
37-
echo 'site.asyncraft.club' > ${{ github.workspace }}/build/CNAME
39+
- name: Add CNAME
40+
run: echo 'site.asyncraft.club' > build/CNAME
3841

39-
- name: Deploy to Pages
40-
uses: peaceiris/actions-gh-pages@v3
42+
- name: Upload Pages artifact
43+
uses: actions/upload-pages-artifact@v3
4144
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
publish_dir: ${{ github.workspace }}/build
44-
publish_branch: gh-pages
45-
destination_dir: .
45+
path: build
46+
47+
deploy:
48+
needs: build
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@giscus/react": "^3.1.0",
2323
"@mdx-js/react": "^3.1.1",
2424
"@theme-ui/prism": "^0.16.2",
25-
"cheerio": "^1.1.2",
25+
"cheerio": "^1.2.0",
2626
"clsx": "^2.1.1",
2727
"hast-util-is-element": "^3.0.0",
2828
"node-mcstatus": "^1.2.1",
@@ -37,8 +37,8 @@
3737
"@docusaurus/module-type-aliases": "^3.9.2",
3838
"@docusaurus/tsconfig": "^3.9.2",
3939
"@docusaurus/types": "^3.9.2",
40-
"@types/node": "^24.10.4",
41-
"@types/react": "^19.2.7",
40+
"@types/node": "^24.11.0",
41+
"@types/react": "^19.2.14",
4242
"@types/react-dom": "^19.2.3",
4343
"@types/webpack-env": "^1.18.8",
4444
"glob": "^11.1.0",

0 commit comments

Comments
 (0)