Improve gh pages #380
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GH Doxygen | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| DOXYGEN_VERSION: "1.14.0" | |
| CMAKE_VERSION: "4.0.3" | |
| GRAPHVIZ_VERSION: "13.1.1" | |
| jobs: | |
| generate-docs: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: "true" | |
| ################################## | |
| # 📦 Cache and Install CMake | |
| ################################## | |
| - name: Cache CMake | |
| id: cache-cmake | |
| uses: actions/cache@v4 | |
| with: | |
| path: cmake-install | |
| key: cmake-cache-${{ env.CMAKE_VERSION }} | |
| - name: Install CMake | |
| if: steps.cache-cmake.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p cmake-install | |
| curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz | |
| tar -xf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz --strip-components=1 -C cmake-install | |
| shell: bash | |
| - name: Add CMake to PATH | |
| run: echo "${GITHUB_WORKSPACE}/cmake-install/bin" >> $GITHUB_PATH | |
| ################################## | |
| # 📦 Cache and Install Graphviz | |
| ################################## | |
| - name: Cache Graphviz | |
| id: cache-graphviz | |
| uses: actions/cache@v4 | |
| with: | |
| path: graphviz-install | |
| key: graphviz-cache-${{ env.GRAPHVIZ_VERSION }} | |
| - name: Install Graphviz | |
| if: steps.cache-graphviz.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p graphviz-install | |
| curl -LO https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/${GRAPHVIZ_VERSION}/graphviz-${GRAPHVIZ_VERSION}.tar.gz | |
| tar -xf graphviz-${GRAPHVIZ_VERSION}.tar.gz -C graphviz-install --strip-components=1 | |
| shell: bash | |
| - name: Add Graphviz to PATH | |
| run: echo "${GITHUB_WORKSPACE}/graphviz-install/bin" >> $GITHUB_PATH | |
| ################################## | |
| # 📦 Cache and Install Doxygen | |
| ################################## | |
| - name: Cache Doxygen | |
| id: cache-doxygen | |
| uses: actions/cache@v4 | |
| with: | |
| path: doxygen-${{ env.DOXYGEN_VERSION }} | |
| key: doxygen-cache-${{ env.DOXYGEN_VERSION }} | |
| - name: Install Doxygen from GitHub | |
| if: steps.cache-doxygen.outputs.cache-hit != 'true' | |
| run: | | |
| version_underscore=$(echo "$DOXYGEN_VERSION" | sed 's/\./_/g') | |
| dirname=doxygen-$DOXYGEN_VERSION | |
| filename_tar=$dirname.linux.bin.tar | |
| filename_gz=$filename_tar.gz | |
| url=https://github.com/doxygen/doxygen/releases/download/Release_$version_underscore/$filename_gz | |
| wget $url | |
| gunzip $filename_gz | |
| tar xf $filename_tar | |
| shell: bash | |
| - name: Add Doxygen to PATH | |
| run: echo "${GITHUB_WORKSPACE}/doxygen-${{ env.DOXYGEN_VERSION }}/bin" >> $GITHUB_PATH | |
| ################################## | |
| # 📚 Generate Doxygen Documentation | |
| ################################## | |
| - name: Generate Doxygen Documentation | |
| run: | | |
| mkdir build && cd build | |
| cmake .. -DBUILD_SOURCE=OFF -DDOXYGEN_GENERATE_LATEX=FALSE | |
| cmake --build . --target doxygen | |
| ################################## | |
| # 🚀 Deploy to GitHub Pages | |
| ################################## | |
| - name: Upload documentation to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/doxygen/build/html | |
| publish_branch: gh-pages # explicit (default) | |
| keep_files: false # remove anything that isn't in publish_dir | |
| force_orphan: true # recreate gh-pages as a single clean commit | |
| # In the repository settings, go to Actions -> General -> Workflow permissions | |
| # and enable Read and write permissions. | |
| # After the workflow runs successfully, go to Settings -> Pages -> Branch | |
| # select `gh-pages` and click "Save". |