Files
dao-os-docs/.gitea/workflows/build_and_deploy_docs.yml
李东云 c2140e6912
Some checks failed
Build and Deploy Dao OS Docs / build-and-deploy (push) Failing after 7s
ci(文档): 添加构建和部署文档的Gitea工作流
添加一个新的Gitea Actions工作流文件,用于在推送至main分支时自动构建mdBook文档并部署到Gitea Pages。工作流包含以下步骤:
1. 检出代码库
2. 安装mdBook工具
3. 构建文档
4. 清理旧文档并部署新文档到指定目录
2025-06-05 14:45:58 +08:00

37 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build and Deploy Dao OS Docs
on:
push:
branches:
- main # 当推送到 main 分支时触发
jobs:
build-and-deploy:
runs-on: ubuntu-latest # 或者你的 Gitea Actions 运行器
steps:
- name: Checkout repository
uses: actions/checkout@v4 # 使用最新的 checkout action
- name: Install mdBook
run: |
RUSTUP_TOOLCHAIN=stable cargo install mdbook --locked --no-default-features # 只安装 mdbook不安装额外特性以加速
- name: Build mdBook
run: mdbook build # 构建文档到默认的 'book' 目录
- name: Deploy to Gitea Pages
# 这里需要以 root 权限访问 Gitea PAGES_ROOT
# 实际部署时可能需要 SSH 密钥、或 Gitea Runner 特殊权限,
# 或者 Gitea Actions 提供了官方的 Pages 部署 action
# 假设你的 Gitea Runner 有权限写入 /root/gitea/gitea/data/pages/dao-os/dao-os-docs/
run: |
# 清理旧的 docs 目录
sudo rm -rf /root/gitea/gitea/data/pages/dao-os/dao-os-docs/*
# 复制新构建的文档
sudo cp -r book/* /root/gitea/gitea/data/pages/dao-os/dao-os-docs/
env:
# 你可能需要在这里配置 SSH 密钥或其他凭据,以便 Gitea Runner 有权限写入目标目录
# GITEA_SSH_KEY: ${{ secrets.GITEA_SSH_KEY }}
# 确保 Gitea Runner 运行用户拥有 /root/gitea/gitea/data/pages/ 的写入权限
# 或者,如果你使用官方的 Pages 部署 action则无需手动 cp