name: Deploy Documentation to GitHub Pages
on:
  workflow_dispatch: 

permissions:
  contents: write
  
jobs:
  generate-documentation:
    runs-on: [ubuntu-latest]

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - uses: mamba-org/setup-micromamba@v2
        with:
          environment-file: environment.yml
          cache-environment: true
          cache-downloads: false
          generate-run-shell: true

      - name: Activate Conda Environment amd Make Docs
        run: |
          pip install -e .[docs,dev]
          mkdocs build -d ./site
        shell: micromamba-shell {0}
      
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./site
