File tree Expand file tree Collapse file tree 1 file changed +24
-16
lines changed Expand file tree Collapse file tree 1 file changed +24
-16
lines changed Original file line number Diff line number Diff line change 1
- name : Deploy to gh-pages with Subdirectory
1
+ name : Deploy to gh-pages
2
2
3
3
on :
4
4
push :
5
5
branches : ["main"]
6
- workflow_dispatch :
6
+
7
+ # 关键权限设置
8
+ permissions :
9
+ contents : write # 允许写入仓库
10
+ pages : write # 允许操作GitHub Pages
11
+ id-token : write # 允许OIDC认证
7
12
8
13
jobs :
9
14
deploy :
10
15
runs-on : ubuntu-latest
16
+ environment :
17
+ name : github-pages
18
+ url : ${{ steps.deployment.outputs.page_url }}
19
+
11
20
steps :
12
21
- uses : actions/checkout@v4
22
+ with :
23
+ fetch-depth : 0 # 获取完整git历史
13
24
14
- # 1. 安装 mdBook (快速安装预编译版本)
25
+ # 安装mdBook(使用预编译二进制)
15
26
- name : Setup mdBook
16
27
run : |
17
28
curl -fsSL https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdbook-v0.4.34-x86_64-unknown-linux-gnu.tar.gz | tar xz
18
- sudo install mdbook /usr/local/bin/
29
+ sudo mv mdbook /usr/local/bin/
19
30
20
- # 2. 构建书籍到子目录
31
+ # 构建到子目录
21
32
- name : Build book
22
33
run : |
23
34
mdbook build
24
- mkdir -p ./gh-pages/embodied-intelligence-lab
25
- mv book/* ./gh-pages/embodied-intelligence-lab/
26
-
27
- # 写入CNAME文件 (无重定向)
28
- echo "ebook.opencamp.cn" > ./gh-pages/CNAME
35
+ mkdir -p gh-pages/embodied-intelligence-lab
36
+ mv book/* gh-pages/embodied-intelligence-lab/
37
+ echo "ebook.opencamp.cn" > gh-pages/CNAME
29
38
30
- # 3. 部署到 gh-pages 分支
39
+ # 部署到gh-pages分支
31
40
- name : Deploy
32
- uses : peaceiris/actions-gh-pages@v3
41
+ id : deployment
42
+ uses : actions/deploy-pages@v2
33
43
with :
34
- github_token : ${{ secrets.GITHUB_TOKEN }}
35
- publish_dir : ./gh-pages
36
- destination_dir : . # 重要:直接发布到gh-pages根目录
37
- keep_files : false # 完全替换旧内容
44
+ token : ${{ secrets.GITHUB_TOKEN }}
45
+ path : ./gh-pages
You can’t perform that action at this time.
0 commit comments