name: Documentation

env:
  packageName: 'kibicara'

on:
  push:
    branches:
      - master
  release:
    types: [published, created, edited]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install .
        pip install pdoc3
    - name: Build documentation with pdoc3
      run: |
        pdoc -f -o build --html ${{ env.packageName }}
    - name: Deploy documentation onto gh-pages
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        BRANCH: gh-pages # The branch the action should deploy to.
        FOLDER: build/${{ env.packageName }} # The folder the action should deploy.
        CLEAN: true