name: Deploy docs
on:
  push:
    branches: main

jobs:
  update-pages:
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@v5

    - name: Select python
      uses: actions/setup-python@v5
      with:
        python-version: 3.12

    - name: Build sdist
      run: |
        python -m pip install build
        python -m build --sdist
      env:
        GSSAPI_SUPPORT_DETECT: false
        GSSAPI_LINKER_ARGS: ''
        GSSAPI_COMPILER_ARGS: ''

    - name: Build docs
      run: ./ci/run-on-linux.sh ./ci/before-docs-deploy.sh
      env:
        DISTRO: fedora:latest

    - name: Deploy latest docs
      uses: JamesIves/github-pages-deploy-action@v4
      with:
        branch: gh-pages
        folder: ci_docs_build
        target-folder: latest
