name: Deploy Example Layout Slots

on:
  push:
    tags:
      - v*
  workflow_dispatch:

jobs:
  deploy-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install pnpm
        uses: pnpm/action-setup@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: pnpm

      - name: Install deps
        run: pnpm install --frozen-lockfile

      - name: Build Packages
        run: pnpm build:package

      - name: Docs build
        env:
          NODE_OPTIONS: --max_old_space_size=8192
        run: cd examples/layout-slots && pnpm docs:build

      - name: Deploy docs
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages-layout-slots
          folder: examples/layout-slots/docs/.vuepress/dist
          single-commit: true
