-
Notifications
You must be signed in to change notification settings - Fork 239
92 lines (80 loc) · 3.2 KB
/
deployment.yml
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
85
86
87
88
89
90
91
92
name: Deploy Namviek
on:
push:
branches:
- main
# paths-ignore:
# - packages/ui-app/**
# - packages/shared-ui/**
# - packages/goalie-nextjs/**
jobs:
build-backend-api:
runs-on: myvps
environment: production
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: create pm2.json file
run: |
echo '{"apps":[{"name":"kampuni-be","script":"npm","args":"run prod:be"}, {"name":"kampuni-se","script":"npm","args":"run prod:se"}]}' > pm2.json
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: install node_modules
run: |
yarn install
yarn generate2
- name: install pm2 for starting nodejs app forever
run: npm install pm2 -g
- name: build backend source
run: |
yarn build:be
yarn build:se
- name: add environment variables
run: |
date > ./packages/be-gateway/built.time
echo "NEXT_PUBLIC_FE_GATEWAY=${{ vars.NEXT_PUBLIC_FE_GATEWAY }}
NEXT_PUBLIC_BE_GATEWAY=
PORT=${{ vars.PORT }}
NEXT_PUBLIC_APP_NAME=
MONGODB_URL=${{ vars.MONGODB_URL }}
JWT_SECRET_KEY=${{ vars.JWT_SECRET_KEY }}
JWT_REFRESH_KEY=${{ vars.JWT_REFRESH_KEY }}
JWT_VERIFY_USER_LINK_TOKEN_EXPIRED=${{ vars.JWT_VERIFY_USER_LINK_TOKEN_EXPIRED }}
JWT_TOKEN_EXPIRED=${{ vars.JWT_TOKEN_EXPIRED }}
JWT_REFRESH_EXPIRED=${{ vars.JWT_REFRESH_EXPIRED }}
REDIS_HOST=
RESEND_TOKEN=${{ vars.RESEND_TOKEN }}
RESEND_EMAIL_DOMAIN=${{ vars.RESEND_EMAIL_DOMAIN }}
AWS_ACCESS_KEY=${{ vars.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY=${{ vars.AWS_SECRET_ACCESS_KEY }}
AWS_REGION=${{ vars.AWS_REGION }}
AWS_S3_BUCKET=${{ vars.AWS_S3_BUCKET }}
REPLICATE_API_TOKEN=${{ vars.REPLICATE_API_TOKEN }}
OPEN_API_KEY=${{ vars.OPEN_API_KEY }}
# Pusher beam
NEXT_PUBLIC_PUSHER_INSTANCE_ID=
PUSHER_INSTANCE_ID=${{ vars.PUSHER_INSTANCE_ID }}
PUSHER_SECRET_KEY=${{ vars.PUSHER_SECRET_KEY }}
# Pusher channel
NEXT_PUBLIC_PUSHER_CHANNEL_APP_KEY=${{ vars.NEXT_PUBLIC_PUSHER_CHANNEL_APP_KEY }}
NEXT_PUBLIC_PUSHER_CHANNEL_APP_CLUSTER=${{ vars.NEXT_PUBLIC_PUSHER_CHANNEL_APP_CLUSTER }}
PUSHER_CHANNEL_APP_ID=${{ vars.PUSHER_CHANNEL_APP_ID }}
PUSHER_CHANNEL_SECRET=${{ vars.PUSHER_CHANNEL_SECRET }}
# Livekit
LIVEKIT_API_KEY=${{ vars.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET=${{ vars.LIVEKIT_API_SECRET }}
NEXT_PUBLIC_LIVEKIT_URL=${{ vars.NEXT_PUBLIC_LIVEKIT_URL }}
# Firebase
FIREBASE_PROJECT_ID=${{vars.FIREBASE_PROJECT_ID}}
FIREBASE_CLIENT_EMAIL=${{vars.FIREBASE_CLIENT_EMAIL}}
FIREBASE_PRIVATE_KEY=${{vars.FIREBASE_PRIVATE_KEY}}
# Logtail
LOGTAIL_SOURCE_TOKEN=${{vars.LOGTAIL_SOURCE_TOKEN}}
" > .env
- name: run app
run: |
pm2 start pm2.json &
- name: finish deployment
run: echo 'finish deployment'