Skip to content

Commit b0dde2f

Browse files
committed
chore: change workflow
1 parent ea03e76 commit b0dde2f

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/github-pages.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,25 @@ on:
55
branches:
66
- master
77

8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
819
jobs:
9-
build-and-deploy:
20+
build:
1021
runs-on: ubuntu-latest
1122

23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deployment.outputs.page_url }}
26+
1227
steps:
1328
- name: Checkout repository
1429
uses: actions/checkout@v4
@@ -38,12 +53,20 @@ jobs:
3853
- name: Convert README-zh-cn.md to zh-cn.html
3954
run: pandoc README-zh-cn.md -t html -o web/assets/zh-cn.html
4055

41-
- name: Deploy to GitHub Pages
42-
uses: peaceiris/actions-gh-pages@v4
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v3
4358
with:
44-
github_token: ${{ secrets.GITHUB_TOKEN }}
45-
publish_dir: ./web # 部署 web/ 目录下的内容
46-
publish_branch: gh-pages # 推送到 gh-pages 分支
47-
force_orphan: true # 可选:保持 gh-pages 分支干净,只保留最新部署
48-
user_name: 'pynickle' # 可选:提交者名称
49-
user_email: '2330458484@qq.com' # 可选:提交者邮箱
59+
# Upload entire repository
60+
path: ./web
61+
62+
deploy:
63+
runs-on: ubuntu-latest
64+
needs: build # 依赖 build 作业
65+
environment:
66+
name: github-pages # Pages 环境
67+
url: ${{ steps.deployment.outputs.page_url }} # 可选:输出 URL
68+
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4 # 使用 v4 部署

0 commit comments

Comments
 (0)