name: 'Build Documentation'
description: 'Build documentation'

runs:
  using: "composite"
  steps:
    - name: Setup machine
      uses: ./.github/actions/setup-linux

    - name: Install dependencies
      shell: bash
      run: |
        sudo apt-get install -y doxygen
        source .venv/bin/activate
        pip install -r docs/requirements.txt
        pip install . -v
  
    - name: Build documentation
      shell: bash
      run: |
        source .venv/bin/activate
        cd docs
        doxygen
        make html O=-W
    
    - name: Create artifact tar
      shell: bash
      run: tar -cf artifact.tar -C docs --dereference build/html index.html

    # Do it manually because upload-pages-artifact requires gtar
    - name: Upload artifact
      id: upload-artifact
      uses: actions/upload-artifact@v5
      with:
        name: github-pages
        path: artifact.tar
        retention-days: 1
        if-no-files-found: error
