name: Validate Website

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build_next:
    name: Build
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup
        uses: ./.github/actions/setup-js

      - name: Restore emsdk
        uses: ./.github/actions/cache-emsdk

      - name: Build Website
        run: yarn build
        working-directory: website

  typecheck:
    name: Typecheck [Docusaurus]
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup
        uses: ./.github/actions/setup-js

      - name: yarn tsc
        run: yarn tsc
        working-directory: website
