Skip to content

Commit 27a149d

Browse files
committed
2 parents d064fc5 + 14879d9 commit 27a149d

8 files changed

Lines changed: 430 additions & 204 deletions

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: ☁️ Deploy to Cloudflare Pages (Runtime)
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: cloudflare-pages-runtime-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
deploy-runtime:
17+
name: 🏗 Build and Deploy Runtime
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: 🔍 Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: 🔒 Verify Google services secret exists
25+
run: |
26+
if [ -z "${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}" ]; then
27+
echo "❌ GOOGLE_SERVICES_JSON_BASE64 secret is missing"
28+
exit 1
29+
fi
30+
31+
- name: 📁 Create google-services.json
32+
run: |
33+
echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > google-services.json
34+
if ! jq empty google-services.json; then
35+
echo "❌ google-services.json is invalid"
36+
exit 1
37+
fi
38+
env:
39+
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
40+
41+
- name: 📦 Install pnpm
42+
run: npm install -g pnpm@10
43+
44+
- name: ⚙️ Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: '24'
48+
cache: 'pnpm'
49+
50+
- name: 📥 Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: 🏗 Build Next.js for runtime
54+
env:
55+
NEXT_OUTPUT_MODE: standalone
56+
run: pnpm build
57+
58+
- name: 🏗 Build Cloudflare Pages output (functions + static)
59+
run: pnpm dlx @cloudflare/next-on-pages@1
60+
61+
- name: 🔎 Verify Cloudflare Pages project exists
62+
env:
63+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
64+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
65+
PROJECT_NAME: ${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME_RUNTIME }}
66+
run: |
67+
RESPONSE=$(curl -fsSL \
68+
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
69+
-H "Content-Type: application/json" \
70+
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects")
71+
72+
COUNT=$(printf '%s' "$RESPONSE" | jq '.result | length')
73+
MATCH=$(printf '%s' "$RESPONSE" | jq --arg name "$PROJECT_NAME" 'any(.result[]?; .name == $name)')
74+
75+
echo "Pages projects visible in this account: $COUNT"
76+
77+
if [ "$MATCH" != "true" ]; then
78+
echo "Configured Pages project was not found in the provided Cloudflare account."
79+
echo "Verify CLOUDFLARE_ACCOUNT_ID points to the same account that owns the Pages project."
80+
echo "Visible project names:"
81+
printf '%s' "$RESPONSE" | jq -r '.result[]?.name'
82+
exit 1
83+
fi
84+
85+
echo "Configured Pages project exists in the target account."
86+
87+
- name: 🚀 Deploy runtime app to Cloudflare Pages
88+
uses: cloudflare/wrangler-action@v3
89+
with:
90+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
91+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
92+
command: >-
93+
pages deploy .vercel/output/static
94+
--project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME_RUNTIME }}
95+
--branch=${{ github.ref_name }}
96+
--commit-hash=${{ github.sha }}
97+
--functions=.vercel/output/functions
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: ☁️ Deploy to Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: cloudflare-pages-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
deploy:
17+
name: 🏗 Build and Deploy
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: 🔍 Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: 📦 Install pnpm
25+
run: npm install -g pnpm@10
26+
27+
- name: ⚙️ Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '24'
31+
cache: 'pnpm'
32+
33+
- name: 🚫 Remove server-only paths for export build
34+
run: |
35+
echo "Pruning dynamic/server paths not supported by static export..."
36+
rm -rf src/app/api src/server src/proxy.ts src/app/jobs/[id] src/app/[...not-found] prisma.config.ts
37+
38+
- name: 📥 Install dependencies
39+
run: pnpm install --frozen-lockfile
40+
41+
- name: 🏗 Build static export
42+
env:
43+
NEXT_OUTPUT_MODE: export
44+
GITHUB_PAGES: 1
45+
NEXT_BASE_PATH: ''
46+
run: |
47+
pnpm build
48+
49+
- name: 🔎 Verify Cloudflare Pages project exists
50+
env:
51+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
52+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
53+
PROJECT_NAME: ${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }}
54+
run: |
55+
RESPONSE=$(curl -fsSL \
56+
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
57+
-H "Content-Type: application/json" \
58+
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects")
59+
60+
COUNT=$(printf '%s' "$RESPONSE" | jq '.result | length')
61+
MATCH=$(printf '%s' "$RESPONSE" | jq --arg name "$PROJECT_NAME" 'any(.result[]?; .name == $name)')
62+
63+
echo "Pages projects visible in this account: $COUNT"
64+
65+
if [ "$MATCH" != "true" ]; then
66+
echo "Configured Pages project was not found in the provided Cloudflare account."
67+
echo "Verify CLOUDFLARE_ACCOUNT_ID points to the same account that owns the Pages project."
68+
echo "Visible project names:"
69+
printf '%s' "$RESPONSE" | jq -r '.result[]?.name'
70+
exit 1
71+
fi
72+
73+
echo "Configured Pages project exists in the target account."
74+
75+
- name: 🚀 Deploy to Cloudflare Pages
76+
uses: cloudflare/wrangler-action@v3
77+
with:
78+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
79+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
80+
command: >-
81+
pages deploy out
82+
--project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }}
83+
--branch=${{ github.ref_name }}

.github/workflows/deploy-docker.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"framer-motion": "^12.29.0",
2525
"gsap": "^3.14.2",
2626
"motion": "^12.29.0",
27-
"next": "16.1.7",
27+
"next": "16.2.2",
2828
"next-nprogress-bar": "^2.4.7",
2929
"next-transition-router": "^0.2.11",
3030
"prisma-dbml-generator": "^0.12.0",

0 commit comments

Comments
 (0)