name: Build Doxygen Docs

on:
  workflow_run:
    workflows: ["Build and Test"]
    types:
      - completed

jobs:
  deploy:
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Install Doxygen
      run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
    - name: Generate Doxygen Documentation
      run: doxygen Doxyfile
    - name: Deploy to GitHub Pages
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./docs/html
