name: Documentation

on:
  push:
    branches:
      - main

jobs:
  build:
    name: Build Docusaurus
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./docs
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup Mise
        uses: immich-app/devtools/actions/use-mise@REDACTED_GITEA_TOKEN # use-mise-action-v1.1.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - run: mise docs:build

      - name: Upload Build Artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./docs/build

  deploy:
    name: Deploy to GitHub Pages
    needs: build

    permissions:
      pages: write # to deploy to Pages
      id-token: write # to verify the deployment originates from an appropriate source

    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
