
name: Generate a build and push to Cloudflare Pages

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build and Deploy to Cloudflare Pages

    steps:
      - name: git-checkout
        uses: actions/checkout@v5

      - name: pnpm-setup
        uses: pnpm/action-setup@v4
        with:
          version: 10
          
      - name: Install Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: pnpm   

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Build
        run: pnpm build
        env:
          PUBLIC_TURNSTILE_SITEKEY: ${{ vars.TURNSTILE_SITEKEY }}

      - name: Deploy
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy ./dist --project-name=portfolio


      


      
