---
name: Deploy documentation 📖

on:
  push:
    branches:
      - main


jobs:
  build-and-deploy:
    concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v7.0.1

      - name: Use Node.js
        uses: actions/setup-node@v7.0.0
        with:
          node-version: 24.x
          cache: 'npm'

      - name: Install and Build 🔧
        run: |
          npm ci
          mkdir html
          touch html/.nojekyll
          node src/cli.js -i schemata -o html/index.html
          ls -ltur html

      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: html
          branch: gh-pages
          clean-exclude: pr-preview
