# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  push:
  pull_request:
    branches:
      - master
      - develop
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [22.x, 24.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
      - uses: actions/checkout@v7
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - run: npm ci
      - run: npm run build
      - run: npm run lint
      - run: npm test
      - run: npm run docs
      - run: sed -i '/doc/d' .gitignore
      - name: Deploy docs to GitHub pages
        uses: JamesIves/github-pages-deploy-action@v4.9.0
        with:
          branch: gh-pages
          folder: .
        if: github.ref == 'refs/heads/master' && matrix.node-version == '24.x'
