|
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 | | - |
5 | 1 | name: GH Doxygen |
6 | 2 |
|
7 | 3 | on: |
|
11 | 7 | workflow_dispatch: |
12 | 8 |
|
13 | 9 | 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" |
15 | 13 |
|
16 | 14 | jobs: |
17 | | - deploy: |
| 15 | + generate-docs: |
18 | 16 | runs-on: ubuntu-latest |
19 | 17 |
|
20 | 18 | defaults: |
21 | 19 | run: |
22 | 20 | shell: bash |
23 | 21 |
|
24 | 22 | steps: |
25 | | - - uses: actions/checkout@v3 |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
26 | 25 | with: |
27 | 26 | submodules: "true" |
28 | 27 |
|
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 }} |
31 | 38 |
|
32 | 39 | - 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 |
34 | 46 |
|
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 |
37 | 49 |
|
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' |
41 | 62 | 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 |
44 | 67 |
|
| 68 | + - name: Add Graphviz to PATH |
| 69 | + run: echo "${GITHUB_WORKSPACE}/graphviz-install/bin" >> $GITHUB_PATH |
| 70 | + |
| 71 | + ################################## |
| 72 | + # 📦 Cache and Install Doxygen |
| 73 | + ################################## |
45 | 74 | - name: Cache Doxygen |
46 | 75 | id: cache-doxygen |
47 | 76 | uses: actions/cache@v4 |
48 | 77 | with: |
49 | 78 | 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 }} |
53 | 80 |
|
54 | 81 | - name: Install Doxygen from GitHub |
55 | 82 | if: steps.cache-doxygen.outputs.cache-hit != 'true' |
56 | 83 | run: | |
57 | | - version_underscore=$(echo "$DOXYGEN_VERSION" | sed -r 's/\./_/g') |
| 84 | + version_underscore=$(echo "$DOXYGEN_VERSION" | sed 's/\./_/g') |
58 | 85 | dirname=doxygen-$DOXYGEN_VERSION |
59 | 86 | filename_tar=$dirname.linux.bin.tar |
60 | 87 | filename_gz=$filename_tar.gz |
61 | 88 | url=https://github.com/doxygen/doxygen/releases/download/Release_$version_underscore/$filename_gz |
62 | 89 | wget $url |
63 | 90 | gunzip $filename_gz |
64 | 91 | tar xf $filename_tar |
65 | | - echo "${GITHUB_WORKSPACE}/$dirname/bin" >> $GITHUB_PATH |
| 92 | + shell: bash |
66 | 93 |
|
| 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 | + ################################## |
67 | 100 | - name: Generate Doxygen Documentation |
68 | 101 | run: | |
69 | 102 | mkdir build && cd build |
70 | 103 | cmake .. -DBUILD_SOURCE=OFF -DDOXYGEN_GENERATE_LATEX=FALSE |
71 | 104 | cmake --build . --target doxygen |
72 | 105 |
|
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 |
78 | 111 | 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