-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (58 loc) · 1.85 KB
/
Copy pathdeploy.yml
File metadata and controls
61 lines (58 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy-backend:
runs-on: ubuntu-latest
env:
NPM_CONFIG_LEGACY_PEER_DEPS: true
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: cd api && npm install
- name: Check Auth
run: npx wrangler whoami
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: 'api'
command: deploy
deploy-frontend:
runs-on: ubuntu-latest
needs: deploy-backend
env:
NPM_CONFIG_LEGACY_PEER_DEPS: true
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install & Build
env:
VITE_BACKEND_URL: ${{ secrets.VITE_BACKEND_URL }}
VITE_CLOUDINARY_CLOUD_NAME: ${{ secrets.VITE_CLOUDINARY_CLOUD_NAME }}
VITE_CLOUDINARY_UPLOAD_PRESET: ${{ secrets.VITE_CLOUDINARY_UPLOAD_PRESET }}
VITE_TURNSTILE_SITEKEY: ${{ secrets.VITE_TURNSTILE_SITE_KEY }}
run: |
cd client
npm install --legacy-peer-deps
npm run build
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=camp-cash-frontend
workingDirectory: 'client'