All checks were successful
Build and Deploy mdBook to Pages Branch / build-and-deploy (push) Successful in 1m32s
使用通用的 ubuntu-latest runner 替代专用 runner 改用 peaceiris/actions-mdbook 和 actions-gh-pages 简化流程 移除手动缓存和安装 mdbook 的步骤 将部署方式改为推送到 pages 分支
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
name: Build and Deploy mdBook to Pages Branch
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
# 只有 main 分支的变更才会触发部署
|
||
- main
|
||
|
||
jobs:
|
||
build-and-deploy:
|
||
runs-on: ubuntu-latest # 现在我们可以用通用的 Runner,不再需要挂载数据卷
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v2
|
||
with:
|
||
# 获取所有历史记录,以便 peaceiris/actions-gh-pages 操作
|
||
fetch-depth: 0
|
||
|
||
- name: Install mdBook
|
||
uses: peaceiris/actions-mdbook@v1
|
||
|
||
- name: Build mdBook
|
||
run: mdbook build
|
||
|
||
- name: Deploy to 'pages' branch
|
||
uses: peaceiris/actions-gh-pages@v3
|
||
with:
|
||
# 我们用 personal_token 替代默认的 github_token
|
||
personal_token: d58a2e62b51446633a0c87df1591ba34db1ecacb
|
||
# 指定 Gitea 服务器的地址
|
||
external_repository: Dao-OS/dao-os-docs
|
||
# 要推送到哪个分支
|
||
publish_branch: pages
|
||
# 要推送哪个目录下的内容
|
||
publish_dir: ./book
|
||
# 提交代码的用户信息
|
||
user_name: "Gitea Actions"
|
||
user_email: "actions@gitea.example.com"
|
||
# Gitea 需要这个设置
|
||
gitea_server: nest.doylee.cn
|