name: Publish to GitHub Pages

on:
  push:
    branches:
      - master

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Check out
        uses: actions/checkout@v1

      - name: Generate docs
        run: >-
          git config --local user.email "action@github.com"
          && git config --local user.name "GitHub Action"
          && cd docs
          && yarn
          && yarn build:baseUrl

      - name: Publish generated content to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          FOLDER: docs/build
          BRANCH: gh-pages
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
