on:
  push:
    branches:
      - master

jobs:
  test:
    uses: ./.github/workflows/test.yml

  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          persist-credentials: false
      - name: Install
        run: yarn install --frozen-lockfile --non-interactive
      - name: Build
        run: yarn run build
      - name: Deploy GH Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.VUE_CONFETTI_SEMANTIC_RELEASE_GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: yarn run semantic-release
