Skip to content

Commit c70d2f1

Browse files
committed
Improve gh pages
1 parent dfccffb commit c70d2f1

1 file changed

Lines changed: 69 additions & 30 deletions

File tree

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Taken from:
2-
# - https://github.com/marketplace/actions/doxygen-github-pages-deploy-action
3-
# - https://github.com/DenverCoder1/doxygen-github-pages-action/blob/main/action.yml
4-
51
name: GH Doxygen
62

73
on:
@@ -11,71 +7,114 @@ on:
117
workflow_dispatch:
128

139
env:
14-
DOXYGEN_VERSION: 1.14.0
10+
DOXYGEN_VERSION: "1.14.0"
11+
CMAKE_VERSION: "4.0.3"
12+
GRAPHVIZ_VERSION: "13.1.1"
1513

1614
jobs:
17-
deploy:
15+
generate-docs:
1816
runs-on: ubuntu-latest
1917

2018
defaults:
2119
run:
2220
shell: bash
2321

2422
steps:
25-
- uses: actions/checkout@v3
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
2625
with:
2726
submodules: "true"
2827

29-
- name: Update Ubuntu package list
30-
run: sudo apt-get update
28+
29+
##################################
30+
# 📦 Cache and Install CMake
31+
##################################
32+
- name: Cache CMake
33+
id: cache-cmake
34+
uses: actions/cache@v4
35+
with:
36+
path: cmake-install
37+
key: cmake-cache-${{ env.CMAKE_VERSION }}
3138

3239
- name: Install CMake
33-
run: sudo apt-get install -y cmake
40+
if: steps.cache-cmake.outputs.cache-hit != 'true'
41+
run: |
42+
mkdir -p cmake-install
43+
curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
44+
tar -xf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz --strip-components=1 -C cmake-install
45+
shell: bash
3446

35-
- name: Install Graphviz (for doxygen 'dot' component)
36-
run: sudo apt-get install -y graphviz
47+
- name: Add CMake to PATH
48+
run: echo "${GITHUB_WORKSPACE}/cmake-install/bin" >> $GITHUB_PATH
3749

38-
- name: Prepare cache timestamp
39-
id: cache_timestamp
40-
shell: cmake -P {0}
50+
##################################
51+
# 📦 Cache and Install Graphviz
52+
##################################
53+
- name: Cache Graphviz
54+
id: cache-graphviz
55+
uses: actions/cache@v4
56+
with:
57+
path: graphviz-install
58+
key: graphviz-cache-${{ env.GRAPHVIZ_VERSION }}
59+
60+
- name: Install Graphviz
61+
if: steps.cache-graphviz.outputs.cache-hit != 'true'
4162
run: |
42-
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
43-
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
63+
mkdir -p graphviz-install
64+
curl -LO https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/${GRAPHVIZ_VERSION}/graphviz-${GRAPHVIZ_VERSION}.tar.gz
65+
tar -xf graphviz-${GRAPHVIZ_VERSION}.tar.gz -C graphviz-install --strip-components=1
66+
shell: bash
4467

68+
- name: Add Graphviz to PATH
69+
run: echo "${GITHUB_WORKSPACE}/graphviz-install/bin" >> $GITHUB_PATH
70+
71+
##################################
72+
# 📦 Cache and Install Doxygen
73+
##################################
4574
- name: Cache Doxygen
4675
id: cache-doxygen
4776
uses: actions/cache@v4
4877
with:
4978
path: doxygen-${{ env.DOXYGEN_VERSION }}
50-
key: doxygen-cache-${{ steps.cache_timestamp.outputs.timestamp }}
51-
restore-keys: |
52-
doxygen-cache-
79+
key: doxygen-cache-${{ env.DOXYGEN_VERSION }}
5380

5481
- name: Install Doxygen from GitHub
5582
if: steps.cache-doxygen.outputs.cache-hit != 'true'
5683
run: |
57-
version_underscore=$(echo "$DOXYGEN_VERSION" | sed -r 's/\./_/g')
84+
version_underscore=$(echo "$DOXYGEN_VERSION" | sed 's/\./_/g')
5885
dirname=doxygen-$DOXYGEN_VERSION
5986
filename_tar=$dirname.linux.bin.tar
6087
filename_gz=$filename_tar.gz
6188
url=https://github.com/doxygen/doxygen/releases/download/Release_$version_underscore/$filename_gz
6289
wget $url
6390
gunzip $filename_gz
6491
tar xf $filename_tar
65-
echo "${GITHUB_WORKSPACE}/$dirname/bin" >> $GITHUB_PATH
92+
shell: bash
6693

94+
- name: Add Doxygen to PATH
95+
run: echo "${GITHUB_WORKSPACE}/doxygen-${{ env.DOXYGEN_VERSION }}/bin" >> $GITHUB_PATH
96+
97+
##################################
98+
# 📚 Generate Doxygen Documentation
99+
##################################
67100
- name: Generate Doxygen Documentation
68101
run: |
69102
mkdir build && cd build
70103
cmake .. -DBUILD_SOURCE=OFF -DDOXYGEN_GENERATE_LATEX=FALSE
71104
cmake --build . --target doxygen
72105
73-
- name: Create .nojekyll (ensures pages with underscores work on gh pages)
74-
run: touch docs/doxygen/build/html/.nojekyll
75-
76-
- name: Deploy to GitHub Pages
77-
uses: JamesIves/github-pages-deploy-action@v4.4.1
106+
##################################
107+
# 🚀 Deploy to GitHub Pages
108+
##################################
109+
- name: Upload documentation to GitHub Pages
110+
uses: peaceiris/actions-gh-pages@v4
78111
with:
79-
branch: gh-pages
80-
folder: docs/doxygen/build/html
81-
112+
github_token: ${{ secrets.GITHUB_TOKEN }}
113+
publish_dir: ./docs/doxygen/build/html
114+
publish_branch: gh-pages # explicit (default)
115+
keep_files: false # remove anything that isn't in publish_dir
116+
force_orphan: true # recreate gh-pages as a single clean commit
117+
# In the repository settings, go to Actions -> General -> Workflow permissions
118+
# and enable Read and write permissions.
119+
# After the workflow runs successfully, go to Settings -> Pages -> Branch
120+
# select `gh-pages` and click "Save".

0 commit comments

Comments
 (0)