# Description: Build and validate the marketing website (apps/website)
name: 'CI: Website Build'

on:
  push:
    branches: [main, master, website/*]
  pull_request:
    branches-ignore: [wip/*, draft/*, temp/*]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  changes:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    outputs:
      app-website-changes: ${{ steps.changes.outputs.app-website-changes }}
      packages-changes: ${{ steps.changes.outputs.packages-changes }}
    steps:
      - uses: actions/checkout@v6
      - id: changes
        uses: ./.github/actions/changes-filter

  build:
    needs: changes
    if: ${{ needs.changes.outputs.app-website-changes == 'true' || needs.changes.outputs.packages-changes == 'true' }}
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - name: Setup frontend
        uses: ./.github/actions/setup-frontend

      - name: Build website
        env:
          WEBSITE_ASHBY_API_KEY: ${{ secrets.WEBSITE_ASHBY_API_KEY }}
          WEBSITE_ASHBY_JOB_BOARD_NAME: ${{ secrets.WEBSITE_ASHBY_JOB_BOARD_NAME }}
        run: pnpm --filter @comfyorg/website build
