forked from Nova-reward/Nova-Rewards
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (70 loc) · 2.67 KB
/
Copy pathdeploy.yml
File metadata and controls
84 lines (70 loc) · 2.67 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Deploy
on:
push:
branches:
- main # → production
- develop # → staging
jobs:
deploy-backend:
name: Deploy Backend
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
url: ${{ github.ref_name == 'main' && secrets.PROD_BACKEND_URL || secrets.STAGING_BACKEND_URL }}
defaults:
run:
working-directory: novaRewards/backend
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
- run: npm install
- name: Deploy
env:
DEPLOY_HOST: ${{ github.ref_name == 'main' && secrets.PROD_DEPLOY_HOST || secrets.STAGING_DEPLOY_HOST }}
DEPLOY_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
run: |
echo "$DEPLOY_KEY" | base64 -d > /tmp/deploy_key
chmod 600 /tmp/deploy_key
rsync -az --delete \
-e "ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no" \
./ $DEPLOY_USER@$DEPLOY_HOST:/app/nova-backend/
ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no \
$DEPLOY_USER@$DEPLOY_HOST \
"cd /app/nova-backend && npm run start"
deploy-frontend:
name: Deploy Frontend
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
url: ${{ github.ref_name == 'main' && secrets.PROD_FRONTEND_URL || secrets.STAGING_FRONTEND_URL }}
defaults:
run:
working-directory: novaRewards/frontend
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
- run: npm install
- name: Build
env:
NEXT_PUBLIC_API_URL: ${{ github.ref_name == 'main' && secrets.PROD_API_URL || secrets.STAGING_API_URL }}
NEXT_PUBLIC_STELLAR_NETWORK: ${{ github.ref_name == 'main' && 'PUBLIC' || 'TESTNET' }}
run: npm run build
- name: Deploy
env:
DEPLOY_HOST: ${{ github.ref_name == 'main' && secrets.PROD_DEPLOY_HOST || secrets.STAGING_DEPLOY_HOST }}
DEPLOY_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
run: |
echo "$DEPLOY_KEY" | base64 -d > /tmp/deploy_key
chmod 600 /tmp/deploy_key
rsync -az --delete \
-e "ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no" \
.next/ $DEPLOY_USER@$DEPLOY_HOST:/app/nova-frontend/.next/
ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no \
$DEPLOY_USER@$DEPLOY_HOST \
"cd /app/nova-frontend && npm run start"