Skip to content
Closed
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
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to Cloudflare Pages

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write

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

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

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ github.event.repository.name }}
directory: dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
20 changes: 18 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
const nextConfig = {
// Cloudflare Pages configuration
output: 'export',
trailingSlash: true,
distDir: 'dist',

// Image optimization compatibility
images: {
unoptimized: true,
},


// API routes detected - consider using Cloudflare Workers for API
// Note: API routes in pages/api/ won't work with static export
// Consider migrating to Cloudflare Workers or removing API routes

};

module.exports = nextConfig;
14 changes: 14 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = "nextjs-migration"
compatibility_date = "2023-05-18"

[build]
command = "npm run build"
publish = "dist"

# Environment variables
[vars]
NODE_ENV = "production"

# Pages configuration
[[pages_build_output_dir]]
value = "dist"
Loading