Skip to content

Commit 76b883f

Browse files
committed
ci: introduce a workflow that automatically rebuilds the documentation
1 parent f9c43f1 commit 76b883f

File tree

3 files changed

+153
-0
lines changed

3 files changed

+153
-0
lines changed
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Refresh Dev Documentation
2+
3+
on:
4+
repository_dispatch:
5+
types: ["refresh_dev"]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.12
18+
19+
- name: Install documentation dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install --upgrade setuptools
23+
python -m pip install --upgrade Sphinx
24+
python -m pip install --upgrade pydata-sphinx-theme
25+
python -m pip install --upgrade sphinx_code_tabs
26+
27+
- name: Install libdebug dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y --no-install-recommends libdwarf-dev libelf-dev libiberty-dev linux-headers-generic libc6-dbg
31+
32+
- name: Checkout libdebug
33+
uses: actions/checkout@v4
34+
with:
35+
repository: 'libdebug/libdebug'
36+
path: 'libdebug'
37+
ref: 'dev'
38+
39+
- name: Install libdebug
40+
run: |
41+
cd libdebug
42+
python -m pip install --upgrade .
43+
44+
- name: Build documentation
45+
run: |
46+
cd libdebug/docs
47+
./regenerate_docs.sh
48+
rm -r build/html/_static/__pycache__
49+
50+
- name: Checkout docs
51+
uses: actions/checkout@v4
52+
with:
53+
path: 'docs'
54+
55+
- name: Update files and commit changes
56+
run: |
57+
cd libdebug
58+
export LIBDEBUG_VERSION=$(python -m setup --version 2>/dev/null)
59+
cd ..
60+
rm -rf "docs/dev"
61+
mv libdebug/docs/build/html docs/dev
62+
echo $LIBDEBUG_VERSION > docs/dev/version
63+
cd docs
64+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
65+
git config --local user.name "github-actions[bot]"
66+
git add dev/
67+
git commit -a -m "Autorefresh Dev Documentation"
68+
69+
- name: Push changes
70+
uses: ad-m/github-push-action@master
71+
with:
72+
directory: 'docs'
73+
force: true
74+
tags: true

.github/workflows/update_docs.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Update Documentation
2+
3+
on:
4+
repository_dispatch:
5+
types: ["update_docs"]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.12
18+
19+
- name: Install documentation dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install --upgrade setuptools
23+
python -m pip install --upgrade Sphinx
24+
python -m pip install --upgrade pydata-sphinx-theme
25+
python -m pip install --upgrade sphinx_code_tabs
26+
27+
- name: Install libdebug dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y --no-install-recommends libdwarf-dev libelf-dev libiberty-dev linux-headers-generic libc6-dbg
31+
32+
- name: Checkout libdebug
33+
uses: actions/checkout@v4
34+
with:
35+
repository: 'libdebug/libdebug'
36+
path: 'libdebug'
37+
ref: ${{ github.event.client_payload.sha }}
38+
39+
- name: Install libdebug
40+
run: |
41+
cd libdebug
42+
python -m pip install --upgrade .
43+
44+
- name: Build documentation
45+
run: |
46+
cd libdebug/docs
47+
./regenerate_docs.sh
48+
rm -r build/html/_static/__pycache__
49+
50+
- name: Checkout docs
51+
uses: actions/checkout@v4
52+
with:
53+
path: 'docs'
54+
55+
- name: Update files and commit changes
56+
run: |
57+
cd libdebug
58+
export LIBDEBUG_VERSION=$(python -m setup --version 2>/dev/null)
59+
cd ..
60+
export OLD_VERSION=$(cat docs/latest/version)
61+
echo "Removing docs/archive/$OLD_VERSION"
62+
rm -rf "docs/archive/$OLD_VERSION"
63+
mv docs/latest "docs/archive/$OLD_VERSION"
64+
mv libdebug/docs/build/html docs/latest
65+
echo $LIBDEBUG_VERSION > docs/latest/version
66+
cd docs
67+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
68+
git config --local user.name "github-actions[bot]"
69+
git tag -f $LIBDEBUG_VERSION
70+
git add archive/$OLD_VERSION
71+
git commit -a -m "Autorefresh Documentation"
72+
73+
- name: Push changes
74+
uses: ad-m/github-push-action@master
75+
with:
76+
directory: 'docs'
77+
force: true
78+
tags: true

latest/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.5.2

0 commit comments

Comments
 (0)