-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (29 loc) · 991 Bytes
/
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
name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}
- name: Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no [email protected] << 'EOF'
# Navigate to your project directory
cd /var/www/allo-experts-frontend
# Install dependencies
npm install > output.log 2>&1
# Build the project
npm run build >> output.log 2>&1
# Start or restart the application using PM2
pm2 start npm --name "allo-experts-frontend" -- run start >> output.log 2>&1 || pm2 restart "allo-experts-frontend" >> output.log 2>&1
# Save the PM2 process list
pm2 save >> output.log 2>&1
EOF