-
Notifications
You must be signed in to change notification settings - Fork 16
54 lines (47 loc) · 1.7 KB
/
deploy-dev.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
name: Deploy-to-EC2-Dev
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
name: Deploy to EC2 on branch push
runs-on: ubuntu-latest
steps:
- name: Step 0 - Install APT Dependences
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libxmlsec1-dev libxmlsec1-openssl libxml2 libxmlsec1 pkg-config
- name: Step 1 - Checkout the Files
uses: actions/checkout@v3
- name: Step 2 - Install Node.js
uses: actions/setup-node@v1
with:
node-version: '20.9.0'
- name: Step 3 - Build Frontend
run: |
cd web-app
npm install
NODE_OPTIONS="--max-old-space-size=1512" npm run build
- name: Step 4 - Deploy to Dev Server
uses: easingthemes/ssh-deploy@main
env:
SOURCE: "/"
SSH_PRIVATE_KEY: ${{ secrets.AWS_DEV_EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.AWS_DEV_HOST_DNS }}
REMOTE_USER: ${{ secrets.AWS_DEV_USERNAME }}
TARGET: ${{ secrets.AWS_DEV_TARGET_DIR }}
SCRIPT_AFTER: |
set -x
echo "Activate python env."
cd /home/ubuntu/smartapi
source .env/bin/activate
echo "Installing backend requirements."
pip install --upgrade pip
pip install -Ur requirements.txt --no-cache-dir --ignore-installed --force-reinstall
echo "Restarting smartapi backend services..."
sudo systemctl restart smartapi@8000
sleep 10
sudo systemctl restart smartapi@8080
echo "Smartapi backend services restarted!!!"
set +x
echo $RSYNC_STDOUT