# Inactive template: GitHub only loads workflows from .github/workflows/.
name: Publish to GitHub Pages (manual)

on:
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: github-pages
  cancel-in-progress: false

jobs:
  build:
    if: github.ref == 'refs/heads/main'
    name: Build and Tests for GitHub Pages
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pages: read
    env:
      SITE_URL: https://volpatto.github.io
      BASE_PATH: /
    steps:
      - uses: actions/checkout@v4
      - uses: prefix-dev/setup-pixi@v0.10.2
        with:
          pixi-version: v0.72.2
          locked: true
          cache: true
      - name: Configure Pages
        uses: actions/configure-pages@v5
      - name: Checks, build, Tests and artifact security inspection
        run: pixi run --locked verify
      - name: Dependency security audit (including build dependencies)
        run: pixi run --locked audit-dependencies
      - name: Install Chromium for Browser Tests
        run: pixi run --locked pnpm exec playwright install --with-deps chromium
      - name: Browser Tests
        run: pixi run --locked pnpm test:browser
      - name: Save Tests and security reports
        if: ${{ !cancelled() }}
        uses: actions/upload-artifact@v4
        with:
          name: github-pages-tests-and-security
          path: .test-output/
          include-hidden-files: true
          if-no-files-found: ignore
          retention-days: 14
      - uses: actions/upload-pages-artifact@v3
        with:
          path: dist
  deploy:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy
        id: deployment
        uses: actions/deploy-pages@v5
