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 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