name: deploy-photographer-portfolio

on:
  push:
    branches: [main]
    paths:
      - 'templates/photographer-portfolio/**'
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: pages-photographer-portfolio
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
          cache-dependency-path: templates/photographer-portfolio/package-lock.json
      - name: Install deps
        run: npm ci
        working-directory: templates/photographer-portfolio
      - name: Build
        run: npm run build
        working-directory: templates/photographer-portfolio
        env:
          PUBLIC_BASE_PATH: /photographer-portfolio/
          PUBLIC_SITE_URL: https://templates.allanninal.dev
      - uses: actions/upload-pages-artifact@v3
        with:
          path: templates/photographer-portfolio/dist

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4
