Repository navigation
120 lines (114 loc) · 4.13 KB
/
Copy pathdocs.yml
File metadata and controls
120 lines (114 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: docs
on:
push:
branches: [dev, master]
pull_request:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Doxygen and Python docs dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen
python -m pip install --upgrade pip
python -m pip install -r docs/requirements-docs.txt
- name: Generate Doxygen XML
working-directory: docs/site
run: |
mkdir -p ../_build/doxygen
doxygen Doxyfile
python tools/normalize_doxygen_xml.py ../_build/doxygen/xml
- name: Test the language switch
run: node docs/site/tools/tests/test_language_switch.js
- name: Build English documentation
working-directory: docs/site
env:
FINCORE_DOCS_LANGUAGE: en
FINCORE_DOCS_BASEURL: https://cloudquant.github.io/fincore_cpp/en/latest/
run: sphinx-build -b html -W -n --keep-going . ../_build/html/en
- name: Build Chinese documentation
working-directory: docs/site
env:
FINCORE_DOCS_LANGUAGE: zh_CN
FINCORE_DOCS_BASEURL: https://cloudquant.github.io/fincore_cpp/zh-cn/latest/
run: sphinx-build -b html -W -n --keep-going . ../_build/html/zh_CN
- name: Check the built site
run: python docs/site/tools/check_built_site.py
- name: Assemble GitHub Pages site
run: |
mkdir -p site/en/latest site/zh-cn/latest
cp -r docs/_build/html/en/. site/en/latest/
cp -r docs/_build/html/zh_CN/. site/zh-cn/latest/
cp docs/site/root.html site/index.html
cp docs/site/404.html site/404.html
cp docs/site/robots.txt site/robots.txt
python docs/site/tools/write_sitemap.py site https://cloudquant.github.io/fincore_cpp/
touch site/.nojekyll
- name: Upload the deployable site
uses: actions/upload-artifact@v4
with:
name: docs-site
# The dotfile must be listed explicitly: upload-artifact drops
# hidden files, and Pages runs Jekyll without .nojekyll, which would
# omit Sphinx's _static assets.
path: |
site
site/.nojekyll
pages:
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master')
needs: build
runs-on: ubuntu-24.04
outputs:
enabled: ${{ steps.precheck.outputs.enabled }}
steps:
- id: precheck
name: Check whether Pages is enabled for this repository
env:
GH_TOKEN: ${{ github.token }}
run: |
status=$(curl -s -o /dev/null -w '%{http_code}' \
-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/pages")
if [ "$status" = "200" ]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "::notice title=GitHub Pages is not enabled (HTTP $status); docs site built but not published"
fi
- name: Download the deployable site
if: steps.precheck.outputs.enabled == 'true'
uses: actions/download-artifact@v4
with:
name: docs-site
path: site
- name: Configure Pages
if: steps.precheck.outputs.enabled == 'true'
uses: actions/configure-pages@v5
- name: Upload Pages artifact
if: steps.precheck.outputs.enabled == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && needs.pages.outputs.enabled == 'true'
needs: pages
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4