diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index d88fff1..84d5a30 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,27 +1,50 @@ -name: documentation +name: Documentation -on: [push, pull_request, workflow_dispatch] - -permissions: - contents: write +on: + push: + branches: [ site ] + pull_request: + branches: [ site ] jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - name: Install dependencies - run: | - pip install sphinx myst-parser nbsphinx furo - - name: Sphinx build - run: | - sphinx-build docs/docs/source _build - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - with: - publish_branch: gh-pages - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: _build/ - force_orphan: true + - uses: actions/checkout@v3 + with: + ref: site + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.11' + + - name: Install pandoc + run: | + sudo apt-get update + sudo apt-get install -y pandoc + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[docs] + pip install sphinx nbsphinx myst-parser furo + + - name: Install package in editable mode + run: | + pip install -e . + + - name: Build documentation + run: | + cd docs/docs + sphinx-build -b html source _build/html + + - name: Deploy to GitHub Pages + if: github.event_name == 'push' && github.ref == 'refs/heads/site' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/docs/_build/html + publish_branch: gh-pages + force_orphan: true + commit_message: "Deploy documentation updates"