Skip to content

Commit c17d4bf

Browse files
committed
chore: CI deployment
1 parent 2ce5eaa commit c17d4bf

File tree

5 files changed

+4175
-2683
lines changed

5 files changed

+4175
-2683
lines changed

.github/workflows/master.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Deploy to Cloudflare Pages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v5
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version-file: '.nvmrc'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run linter
25+
run: npm run lint
26+
27+
test-unit:
28+
name: Unit Tests
29+
runs-on: ubuntu-latest
30+
needs: lint
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v5
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version-file: '.nvmrc'
40+
cache: 'npm'
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Run unit tests
46+
run: npm run test:unit
47+
48+
- name: Upload coverage reports
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: coverage-report
53+
path: coverage/
54+
if-no-files-found: ignore
55+
retention-days: 7
56+
57+
deploy:
58+
name: Deploy to Cloudflare Pages
59+
runs-on: ubuntu-latest
60+
needs: [lint, test-unit]
61+
environment: production
62+
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v5
66+
67+
- name: Setup Node.js
68+
uses: actions/setup-node@v6
69+
with:
70+
node-version-file: '.nvmrc'
71+
cache: 'npm'
72+
73+
- name: Install dependencies
74+
run: npm ci
75+
76+
- name: Build project
77+
run: npm run build
78+
env:
79+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
80+
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
81+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
82+
83+
- name: Deploy to Cloudflare Pages
84+
uses: cloudflare/wrangler-action@v3
85+
with:
86+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
87+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
88+
command: pages deploy dist --project-name="10x-project"
89+

astro.config.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineConfig } from "astro/config";
44
import react from "@astrojs/react";
55
import sitemap from "@astrojs/sitemap";
66
import tailwindcss from "@tailwindcss/vite";
7-
import node from "@astrojs/node";
7+
import cloudflare from "@astrojs/cloudflare";
88

99
// https://astro.build/config
1010
export default defineConfig({
@@ -14,7 +14,9 @@ export default defineConfig({
1414
vite: {
1515
plugins: [tailwindcss()],
1616
},
17-
adapter: node({
18-
mode: "standalone",
17+
adapter: cloudflare({
18+
platformProxy: {
19+
enabled: true,
20+
},
1921
}),
2022
});

0 commit comments

Comments
 (0)