name: Website Deploy
on:
  push:
    branches:
      - main
    paths:
      - "website/**"
  workflow_dispatch:

jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    if: github.repository == 'fontsource/fontsource'

    steps:
      - name: checkout
        uses: actions/checkout@v4

      - uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest

      - name: Install
        run: bun install

      - name: Build Packages
        run: bun run build

      - name: Run lints
        run: bun run lint
        working-directory: website

      - name: Build & Deploy Worker
        run: bun run deploy
        working-directory: website
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
