Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/deploy-cf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy CF

on:
workflow_dispatch:
push:
branches:
- main
- develop

jobs:
build-and-deploy:
runs-on: ["gha-runner-scale-set-neonevm"]

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build project (Next.js)
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
NEXT_PUBLIC_APP_URL: ${{ github.ref == 'refs/heads/main' && 'https://cookie.neonevm.org' || 'https://develop.fortune-cookie-4bg.pages.dev' }}
run: npm run build

- name: Generate Cloudflare Pages artifacts (Next on Pages)
run: npx --yes @cloudflare/next-on-pages@latest

- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_PAGES_TOKEN }}
command: |
pages deploy ./.vercel/output/static --project-name="fortune-cookie"
1 change: 1 addition & 0 deletions src/app/api/fortune/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const runtime = 'edge'
import { NextRequest, NextResponse } from 'next/server'
import { nanoid } from 'nanoid'
import { getRandomImage, createFortune, logEvent } from '@/lib/supabase'
Expand Down
1 change: 1 addition & 0 deletions src/app/api/variants/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const runtime = 'edge'
import { NextResponse } from 'next/server'
import { supabase } from '@/lib/supabase'

Expand Down
1 change: 1 addition & 0 deletions src/app/f/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const runtime = 'edge'
import { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { getFortuneBySlug, logEvent } from '@/lib/supabase'
Expand Down