name: Deploy docs

on:
  push:
    paths:
      - 'docs/**'
      - 'package.json'
      - 'package-lock.json'
      - 'CHANGELOG.md'
    tags:
      - 8.2.*
jobs:
  docs:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Build VuePress site
        run: npm run docs:build

      - name: Deploy to GitHub Pages
        uses: crazy-max/ghaction-github-pages@v4
        with:
          repo: thunder/thunder.github.io
          target_branch: main
          build_dir: docs/.vuepress/dist
        env:
          GH_PAT: ${{ secrets.PUSH_DOCS_ACCESS_TOKEN }}
