Skip to content

Commit 7e19751

Browse files
committed
deploy fronetend to cloudfare
1 parent 71843d2 commit 7e19751

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy Frontend to Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'client-test/**'
8+
- '.github/workflows/deploy-frontend.yml'
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
name: Deploy to Cloudflare Pages
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
cache-dependency-path: 'client-test/package-lock.json'
25+
26+
- name: Install dependencies
27+
run: |
28+
cd client-test
29+
npm ci
30+
31+
- name: Build application
32+
run: |
33+
cd client-test
34+
npm run build
35+
env:
36+
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
37+
38+
- name: Deploy to Cloudflare Pages
39+
uses: cloudflare/pages-action@v1
40+
with:
41+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
42+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
43+
projectName: codequest-frontend
44+
directory: client-test/dist
45+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

server/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dotenv.config();
77

88
connectDB();
99

10-
// const PORT = process.env.PORT || 5000
11-
// app.listen(PORT, () => { console.log(`Server is running at ${PORT}`); })
10+
const PORT = process.env.PORT || 5000
11+
app.listen(PORT, () => { console.log(`Server is running at ${PORT}`); })
1212

13-
export const handler = serverless(app);
13+
// export const handler = serverless(app);

0 commit comments

Comments
 (0)