name: Deploy web app

env:
 CI: false

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  deploy-web-app:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v1
      - name: Set up Node
        uses: actions/setup-node@v1
        with:
          node-version: '12.x'
      - name: Install packages
        run: yarn install
        working-directory: frontend
      - name: Build app
        run: yarn build
        working-directory: frontend
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: github.event_name == 'push'
        with:
          keep_files: false
          publish_branch: gh-pages
          publish_dir: frontend/build
          github_token: ${{ secrets.GITHUB_TOKEN }}
