From ed147e9a09dc55c7c15ecfb3d39f495c4dc68a6b Mon Sep 17 00:00:00 2001 From: jmbish04 Date: Sun, 4 May 2025 23:06:57 -0700 Subject: [PATCH 1/2] feat: Update package.json for Cloudflare Pages --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1ee82b00f3..a6100071ea 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "prepare": "husky install", "clean": "npm run lint:fix && npm run format:write", "dev": "next dev", - "build": "next build", + "build": "npx @cloudflare/next-on-pages", "start": "next start", "lint": "next lint", "lint:fix": "next lint --fix", @@ -124,6 +124,7 @@ "tailwindcss": "^3.3.5", "tailwindcss-animate": "^1.0.7", "ts-node": "^10.9.2", - "typescript": "^5" + "typescript": "^5", + "@cloudflare/next-on-pages": "^1" } -} +} \ No newline at end of file From aee069c6779051e5eb46422e0265d737db0bc2b5 Mon Sep 17 00:00:00 2001 From: jmbish04 Date: Sun, 4 May 2025 23:06:58 -0700 Subject: [PATCH 2/2] ci: Add Cloudflare deployment workflow --- .github/workflows/deploy-cloudflare.yml | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/deploy-cloudflare.yml diff --git a/.github/workflows/deploy-cloudflare.yml b/.github/workflows/deploy-cloudflare.yml new file mode 100644 index 0000000000..1abef73683 --- /dev/null +++ b/.github/workflows/deploy-cloudflare.yml @@ -0,0 +1,38 @@ +name: Deploy to Cloudflare Pages + +on: + push: + branches: + - main # Trigger deployment on push to main + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' # Or the version required by chatbot-ui + + - name: Install Dependencies + run: npm ci # Use ci for faster, reproducible builds + + - name: Build Application + run: npm run build # Assumes build script is adapted for next-on-pages + + - name: Publish to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 # Use the official wrangler action + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: chatbot-ui-cf + directory: .vercel/output/static # Default output dir for next-on-pages build + # Or use wrangler directly: + # command: pages deploy .vercel/output/static --project-name=chatbot-ui-cf --branch=${{ github.ref_name }} --commit-dirty=true \ No newline at end of file