Skip to content

Commit 59aaa7f

Browse files
committed
doc: upload docs [build-docs].
1 parent 21b41ce commit 59aaa7f

File tree

95 files changed

+677
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+677
-28
lines changed

.github/workflows/docs.yml

Lines changed: 94 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# .github/workflows/docs.yml
2-
name: Build and Deploy Documentation
3-
41
on:
52
push:
63
branches:
@@ -11,47 +8,116 @@ on:
118
paths-ignore:
129
- "README.md"
1310
workflow_dispatch:
14-
# Optional: force build if commit message contains [docs]
11+
# Optional: force build if commit message contains [build-docs]
1512
workflow_call:
1613

1714
jobs:
18-
build-docs:
19-
if: >
20-
contains(github.event.head_commit.message, '[docs]') ||
21-
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v'))
15+
# 检查是否应该强制构建
16+
check-force-build:
2217
runs-on: ubuntu-latest
18+
outputs:
19+
should-build: ${{ steps.check.outputs.should-build }}
20+
force-build: ${{ steps.check.outputs.force-build }}
21+
steps:
22+
- name: Check commit message for force build
23+
id: check
24+
run: |
25+
# 获取提交信息
26+
if [[ "${{ github.event_name }}" == "push" ]]; then
27+
COMMIT_MSG="${{ github.event.head_commit.message }}"
28+
else
29+
# 对于其他事件类型,默认构建
30+
COMMIT_MSG=""
31+
fi
32+
33+
echo "Commit message: $COMMIT_MSG"
34+
35+
# 检查是否包含 [build-docs]
36+
if [[ "$COMMIT_MSG" == *"[build-docs]"* ]]; then
37+
echo "Force build detected in commit message"
38+
echo "should-build=true" >> $GITHUB_OUTPUT
39+
echo "force-build=true" >> $GITHUB_OUTPUT
40+
else
41+
# 非强制构建情况下,检查是否满足正常触发条件
42+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || [[ "${{ github.event_name }}" == "workflow_call" ]]; then
43+
echo "Manual trigger or workflow call"
44+
echo "should-build=true" >> $GITHUB_OUTPUT
45+
echo "force-build=false" >> $GITHUB_OUTPUT
46+
elif [[ "${{ github.event_name }}" == "push" ]]; then
47+
# Push 事件需要检查分支和路径限制
48+
BRANCH_NAME="${{ github.ref_name }}"
49+
echo "Branch: $BRANCH_NAME"
50+
51+
# 检查分支是否匹配
52+
if [[ "$BRANCH_NAME" == "main" ]] || [[ "$BRANCH_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
53+
echo "Branch matches trigger conditions"
54+
echo "should-build=true" >> $GITHUB_OUTPUT
55+
echo "force-build=false" >> $GITHUB_OUTPUT
56+
else
57+
echo "Branch does not match trigger conditions"
58+
echo "should-build=false" >> $GITHUB_OUTPUT
59+
echo "force-build=false" >> $GITHUB_OUTPUT
60+
fi
61+
else
62+
echo "Event does not match trigger conditions"
63+
echo "should-build=false" >> $GITHUB_OUTPUT
64+
echo "force-build=false" >> $GITHUB_OUTPUT
65+
fi
66+
fi
2367
68+
# 主构建任务
69+
build-docs:
70+
runs-on: ubuntu-latest
71+
needs: check-force-build
72+
# 只有当应该构建时才运行
73+
if: needs.check-force-build.outputs.should-build == 'true'
74+
2475
steps:
25-
- name: Checkout source
76+
- name: Checkout code
2677
uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0 # 获取完整历史,用于版本信息
80+
81+
- name: Display build trigger info
82+
run: |
83+
echo "Build triggered by: ${{ github.event_name }}"
84+
echo "Force build: ${{ needs.check-force-build.outputs.force-build }}"
85+
echo "Branch: ${{ github.ref_name }}"
86+
if [[ "${{ needs.check-force-build.outputs.force-build }}" == "true" ]]; then
87+
echo "🚀 Force build activated - ignoring branch/path restrictions"
88+
else
89+
echo "📋 Standard build conditions met"
90+
fi
2791
2892
- name: Set up Python
29-
uses: actions/setup-python@v5
93+
uses: actions/setup-python@v4
3094
with:
31-
python-version: '3.11'
95+
python-version: '3.12'
3296

33-
- name: Install uv package manager
97+
- name: Install dependencies
3498
run: |
35-
curl -LsSf https://astral.sh/uv/install.sh | sh
36-
echo "~/.cargo/bin" >> $GITHUB_PATH
99+
python -m pip install --upgrade pip
100+
pip install mkdocs mkdocs-material mkdocstrings[python] pyyaml
37101
38-
- name: Install documentation dependencies
39-
run: |
40-
uv pip install --system -r requirements-docs.txt
102+
# - name: Generate documentation
103+
# run: |
104+
# python generate_docs.py
41105

42106
- name: Build documentation
43107
run: |
44-
mkdocs build --strict
108+
mkdocs build
45109
46-
- name: Upload built site as artifact
47-
uses: actions/upload-artifact@v4
110+
- name: Deploy to GitHub Pages
111+
if: github.event_name == 'push' || needs.check-force-build.outputs.force-build == 'true'
112+
uses: peaceiris/actions-gh-pages@v3
48113
with:
49-
name: site
50-
path: site/
114+
github_token: ${{ secrets.GITHUB_TOKEN }}
115+
publish_dir: ./site
116+
force_orphan: true
51117

52-
# Optional: deploy to GitHub Pages
53-
# - name: Deploy to GitHub Pages
54-
# uses: peaceiris/actions-gh-pages@v4
55-
# with:
56-
# github_token: ${{ secrets.GITHUB_TOKEN }}
57-
# publish_dir: ./site
118+
- name: Upload documentation artifacts
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: documentation
122+
path: site/
123+
retention-days: 30
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# data_fetcher
2+
3+
Module: `gklearn.dataset.data_fetcher`
4+
5+
::: gklearn.dataset.data_fetcher

docs/reference/dataset/dataset.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# dataset
2+
3+
Module: `gklearn.dataset.dataset`
4+
5+
::: gklearn.dataset.dataset
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# file_managers
2+
3+
Module: `gklearn.dataset.file_managers`
4+
5+
::: gklearn.dataset.file_managers
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# graph_synthesizer
2+
3+
Module: `gklearn.dataset.graph_synthesizer`
4+
5+
::: gklearn.dataset.graph_synthesizer

docs/reference/dataset/metadata.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# metadata
2+
3+
Module: `gklearn.dataset.metadata`
4+
5+
::: gklearn.dataset.metadata

docs/reference/ged/bipartite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# bipartite
2+
3+
Module: `gklearn.ged.methods.bipartite`
4+
5+
::: gklearn.ged.methods.bipartite

docs/reference/ged/common_types.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# common_types
2+
3+
Module: `gklearn.ged.env.common_types`
4+
5+
::: gklearn.ged.env.common_types

docs/reference/ged/constant.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# constant
2+
3+
Module: `gklearn.ged.edit_costs.constant`
4+
5+
::: gklearn.ged.edit_costs.constant
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# cost_matrices_learner
2+
3+
Module: `gklearn.ged.learning.cost_matrices_learner`
4+
5+
::: gklearn.ged.learning.cost_matrices_learner

0 commit comments

Comments
 (0)