name: publish-book

on:
  push:
    branches:
    - main

jobs:
  deploy-book:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install -e .[tf,docs]
        pip install jupyter-book

    - name: Build the book
      run: |
        jupyter-book build .

    - name: GitHub Pages action
      uses: peaceiris/actions-gh-pages@v3.9.0
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./_build/html
