Skip to content

Commit fd51f7d

Browse files
update ci
1 parent a2c68c1 commit fd51f7d

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1-
name: Deploy to gh-pages with Subdirectory
1+
name: Deploy to gh-pages
22

33
on:
44
push:
55
branches: ["main"]
6-
workflow_dispatch:
6+
7+
# 关键权限设置
8+
permissions:
9+
contents: write # 允许写入仓库
10+
pages: write # 允许操作GitHub Pages
11+
id-token: write # 允许OIDC认证
712

813
jobs:
914
deploy:
1015
runs-on: ubuntu-latest
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
1120
steps:
1221
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # 获取完整git历史
1324

14-
# 1. 安装 mdBook (快速安装预编译版本)
25+
# 安装mdBook(使用预编译二进制)
1526
- name: Setup mdBook
1627
run: |
1728
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/
1930
20-
# 2. 构建书籍到子目录
31+
# 构建到子目录
2132
- name: Build book
2233
run: |
2334
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
2938
30-
# 3. 部署到 gh-pages 分支
39+
# 部署到gh-pages分支
3140
- name: Deploy
32-
uses: peaceiris/actions-gh-pages@v3
41+
id: deployment
42+
uses: actions/deploy-pages@v2
3343
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

0 commit comments

Comments
 (0)