name: Deploy Sphinx Docs

on:
  push:
    branches:
      - docs  # or your default branch

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout private repository
        uses: actions/checkout@v2
        with:
          repository: nanophyto/abil
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.x'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt  # Ensure your requirements.txt includes Sphinx
          pip install sphinx
          pip install pydata-sphinx-theme
          pip install sphinx-design

      - name: Build Sphinx documentation
        run: |
          cd docs
          make html
          
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs/_build/html  # Adjust according to your Sphinx setup
          publish_branch: gh-pages  # The branch GitHub Pages usesnanophyto/abil-docs  # The public repository your-username/public-repo  # Replace with your public repository
