name: CI
on: [push, pull_request]
jobs:
  build:
    name: Build & test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x, 16.x, v16.16.0, 18.x]

    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - run: npm install --no-package-lock
      - run: npm test

      - name: Deploy docs
        if: github.ref == 'refs/heads/main' && matrix.node-version == 'v16.16.0'
        uses: JamesIves/github-pages-deploy-action@v4.2.2
        with:
          single-commit: true
          branch: gh-pages
          folder: typedoc