Skip to content

Commit

Permalink
add mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
yongjian_zhang committed Aug 14, 2024
1 parent abf1cb3 commit b93dfb5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deloy Doc

on:
push:
branches:
- develop # 根据您的主分支名称调整
- master
- mkdoc

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 设置Python
uses: actions/setup-python@v2
with:
python-version: '3.10' # 根据您的Python版本调整
- name: 安装依赖
run: |
pip install poetry
poetry install
- name: 构建文档
run: poetry run docs-build
- name: 部署到GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site # MkDocs默认输出目录
7 changes: 7 additions & 0 deletions docly/docs_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import subprocess

def serve():
subprocess.run(["mkdocs", "serve"], check=True)

def build():
subprocess.run(["mkdocs", "build"], check=True)
Empty file added docs/api.md
Empty file.
Empty file added docs/guide.md
Empty file.
Empty file added docs/index.md
Empty file.
9 changes: 9 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
site_name: Docly 文档
site_url: https://yjmm10.github.io/Docly/
theme:
name: material
nav:
- 首页: index.md
- 使用指南: guide.md
- 开发文档: development.md
- API参考: api.md
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ httpx = "^0.27.0"

[tool.poetry.scripts]
docly = "docly.cmdline:main"
docs = "docly.docs_commands:serve"
docs-build = "docly.docs_commands:build"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit b93dfb5

Please sign in to comment.