name: Deploy gh-pages
on:
      push:
            branches:
                  - master
jobs:
      build-and-deploy:
            runs-on: ubuntu-20.04
            steps:
                  - name: Checkout
                    uses: actions/checkout@master

                  - name: Get npm cache
                    id: cache
                    uses: actions/cache@v2
                    with:
                          path: node_modules
                          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
                          restore-keys: |
                                ${{ runner.os }}-node-

                  - name: Install
                    if: steps.cache.outputs.cache-hit != 'true'
                    run: npm install

                  - name: Build
                    run: npm run build

                  - name: Deploy
                    uses: peaceiris/actions-gh-pages@v3
                    with:
                          github_token: ${{ secrets.GITHUB_TOKEN }}
                          publish_dir: ./dist
