Merge pull request #7 from OldCrow/v0.12.1-pre-distribution-refactori… #21
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: Documentation | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build-docs: | |
name: Build Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Doxygen and Graphviz | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y doxygen graphviz | |
- name: Configure CMake | |
run: | | |
cmake -B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_DOCS=ON | |
- name: Build Documentation | |
run: | | |
cmake --build build --target docs | |
- name: Upload documentation artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: build/docs/html | |
retention-days: 7 | |
- name: Check if docs were generated | |
run: | | |
if [ ! -d "build/docs/html" ]; then | |
echo "Documentation was not generated!" | |
exit 1 | |
fi | |
echo "Documentation generated successfully" | |
ls -la build/docs/html/ | |
# Deploy job - only runs on main branch | |
deploy: | |
name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: build-docs | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Download documentation artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: documentation | |
path: ./docs | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload to GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./docs | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |