name: Build microsite

on:
  pull_request:
    paths:
      - '.github/workflows/microsite-build-check.yml'
      - 'microsite/**'
      - 'docs/**'

jobs:
  build-microsite:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x, 14.x]

    env:
      CI: true
      NODE_OPTIONS: --max-old-space-size=4096

    steps:
      - uses: actions/checkout@v2

      - name: use node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

        # Skip caching of microsite dependencies, it keeps the global cache size
        # smaller, which make Windows builds a lot faster for the rest of the project.
      - name: yarn install
        run: yarn install --frozen-lockfile
        working-directory: microsite

      - name: prettier
        run: yarn prettier:check
        working-directory: microsite

      - name: build microsite
        run: yarn build
        working-directory: microsite
