-
Notifications
You must be signed in to change notification settings - Fork 48
119 lines (100 loc) · 3.61 KB
/
docs.yml
File metadata and controls
119 lines (100 loc) · 3.61 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
name: Docs
on:
workflow_dispatch:
push:
branches:
- main
- docs
jobs:
Docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 10
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Requirements
run: |
sudo apt-get update
sudo apt-get install doxygen python3-sphinx graphviz ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Cache Build
id: cache-build
uses: actions/cache@v5
with:
path: ${{ env.CACHE_PATH }}
key: docs-cache
restore-keys: Linux-Python-cache
- name: Prepare Ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats
- name: Copy release docs
run: |
git fetch --all --tags
# Checkout the versioned docs from the gh-pages branch
git checkout origin/gh-pages -- 'v*'
# Move the versioned docs to the build directory
mkdir -p docs/build/html
mv v* docs/build/html/
# Copy the custom.css to each version's build
for version in $(git tag -l); do
if [ -e docs/build/html/$version/_static/css/ ]; then
cp docs/source/_static/css/custom.css docs/build/html/$version/_static/css/
fi
done
# Copy versions.json to the root of the build
cp docs/source/_static/versions.json docs/build/html/
- name: Build new release docs
run: |
HEAD=$(git rev-parse HEAD)
git fetch --all --tags
cd docs
for version in $(git tag -l); do
if [ -d build/html/$version ]; then
echo "Skipping $version (already exists)"
continue
fi
echo "Processing $version:"
git checkout $version
# Fix links
grep -rli 'url = {https://ipc-sim.github.io/ipc-toolkit/}' ../* | xargs -i@ sed -i 's/ipc-sim.github.io\/ipc-toolkit\//github.com\/ipc-sim\/ipc-toolkit/g' @
grep -rli 'ipc-sim.github.io/ipc-toolkit' ../* | xargs -i@ sed -i 's/ipc-sim.github.io\/ipc-toolkit/ipctk.xyz/g' @
pip install --force-reinstall -v "ipctk==$version"
sphinx-build source build/html/$version \
-D html_theme_options.version_dropdown=true \
-D html_theme_options.version_json=https://ipctk.xyz/versions.json
# Discard changes
git reset --hard
done
pip uninstall -y ipctk
git checkout $HEAD
# Copy the custom.css to each version's build
for version in $(git tag -l); do
if [ ! -f build/html/$version/_static/css/custom.css ]; then
cp source/_static/css/custom.css build/html/$version/_static/css/
fi
done
cd ..
- name: Build ipctk
run: |
pip install --verbose .
ccache --show-stats
- name: Build docs
run: |
cd docs
make html
cd build/html
touch .nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.