-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (103 loc) · 3.43 KB
/
documentation.yaml
File metadata and controls
120 lines (103 loc) · 3.43 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: documentation
on:
pull_request:
branches:
- "*"
push:
tags:
- "v*"
jobs:
build-doc:
name: Build and validate documentation
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo apt install doxygen -y
pip install beautifulsoup4
- name: Validate the project version
run: |
VERSION=$(python3 scripts/check_version.py)
echo "project version = $VERSION"
- name: Run doxygen
continue-on-error: false
run: |
doxygen Doxyfile
python3 scripts/postprocess_doxyhtml.py ./documentation
- name: Validate output
run: test -d documentation && test -f documentation/index.html
deploy-doc:
name: Deploy documentation
if: github.event_name == 'push'
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo apt install doxygen -y
pip install beautifulsoup4
- name: Extract and validate the project version
continue-on-error: false
run: |
VERSION=$(python3 scripts/check_version.py)
echo "project version = $VERSION"
VERSION_TAG="${GITHUB_REF##*/}"
echo "git version tag = $VERSION_TAG"
if [[ "$VERSION_TAG" != "v$VERSION" ]]; then
echo "Error: Tag missmatch: git version tag = $VERSION_TAG, project version: v$VERSION"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Run doxygen
continue-on-error: false
run: |
doxygen Doxyfile
python3 scripts/postprocess_doxyhtml.py ./documentation
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./documentation
publish_branch: gh-pages
destination_dir: ${{ env.VERSION }}
- name: Deploy documantation as latest (setup)
if: ${{ success() }}
run: |
CURRENT_VERSION="v${VERSION}"
echo "Current version: $CURRENT_VERSION"
git fetch --tags --force
ALL_TAGS=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V)
LATEST_TAG=$(echo "$ALL_TAGS" | tail -n 1)
echo "Latest tag: $LATEST_TAG"
if [ "$CURRENT_VERSION" = "$LATEST_TAG" ]; then
echo "Current tag is the latest. Deploying to 'latest/'..."
echo "DEPLOY_LATEST=true" >> $GITHUB_ENV
else
echo "Current tag is NOT the latest. Skipping deployment to 'latest/'."
fi
- name: Deploy to GitHub Pages as 'latest'
if: env.DEPLOY_LATEST == 'true'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./documentation
publish_branch: gh-pages
destination_dir: latest