Files
dao-os-docs/.gitea/workflow/build_and_deploy_docs.yml
李东云 a5a0195040 docs: 初始化项目文档和贡献者指南
添加基础文档结构包括 SUMMARY.md、book.toml 和代码行为准则
配置 Gitea 工作流实现文档自动构建和部署
2025-06-05 14:42:51 +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