name: Build CSS

on:
  - push
  - pull_request

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node.js LTS
        uses: actions/setup-node@v2
        with:
          node-version: lts/*
          cache: 'yarn'

      - name: Build
        run: |
          yarn --frozen-lockfile
          yarn test

      - name: Archive artifacts
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist

name: Build CSS

on:
  push:
    branches:
      - '*'
    tags:
      - 'v*'
  pull_request:

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node.js LTS
        uses: actions/setup-node@v2
        with:
          node-version: lts/*
          cache: 'yarn'

      - name: Build
        run: |
          yarn --frozen-lockfile
          yarn test

      - name: Archive artifacts
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: dist

      - name: Deploy main
        uses: peaceiris/actions-gh-pages@v3
        if: github.ref == 'refs/heads/main'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: dist
          destination_dir: dist

      - name: Get tag name
        id: tag
        run: echo "::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}"

      - name: Deploy tag
        uses: peaceiris/actions-gh-pages@v3
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: dist
          destination_dir: ${{ steps.tag.outputs.TAG_NAME }}

Add GitHub Pages deployment steps
Add GitHub Pages deployment steps
