name: deploy

on:
  workflow_call:

jobs:
  deploy-docs:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - uses: ./.github/actions/setup-pixi
        with:
          environments: node

      - name: Build docs
        run: pixi run build-docs

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        if: github.ref == 'refs/heads/main'
        with:
          personal_token: ${{ secrets.PUBLISH_DOCS }}
          external_repository: clice-io/docs
          publish_dir: ./docs/.vitepress/dist
          destination_dir: clice
          keep_files: true
