-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (46 loc) · 1.61 KB
/
deploy.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
name: Deploy Keroguic
on:
push:
branches:
- prod
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Connect to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
echo " ------ Connected to server ------"
cd /var/www/Keroguic
echo "------ Pulling changes ------"
git pull origin prod --ff-only
cd front
echo "------ Installing front dependencies ------"
npm install
echo "------ Building front ------"
npm run build
echo "------ Restarting nginx ------"
sudo systemctl restart nginx
cd ../back
echo "------ Save the data ------" # to do this execute the command in backup.js
node backup.js
echo "------ Installing back dependencies ------"
npm install
echo "------ Restart the postgres container ------"
docker-compose up -d
echo "------ Prisma generate ------"
npx prisma generate
echo "------ Prisma db push ------"
npx prisma db push --force-reset --accept-data-loss
echo "------ Seeding the database ------"
npx prisma db seed
echo "------ Restarting pm2 ------"
pm2 restart all
echo " ------ Deployed ------"