File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to EC2
2
+
3
+ on :
4
+ push :
5
+ branches : ["main"]
6
+
7
+ jobs :
8
+ deploy :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v3
14
+
15
+ - name : Copy files to EC2
16
+
17
+ with :
18
+ host : ${{ secrets.EC2_HOST }}
19
+ username : ${{ secrets.EC2_USER }}
20
+ key : ${{ secrets.EC2_SSH_KEY }}
21
+ source : " ."
22
+ target : " ~/pradan_forms_processing_system_backend"
23
+
24
+ - name : SSH into EC2 and restart app
25
+
26
+ with :
27
+ host : ${{ secrets.EC2_HOST }}
28
+ username : ${{ secrets.EC2_USER }}
29
+ key : ${{ secrets.EC2_SSH_KEY }}
30
+ script : |
31
+ cd ~/pradan_forms_processing_system_backend
32
+ npm install --production
33
+ pm2 restart myapp || pm2 start index.js --name "Pradan-app-backend"
34
+ pm2 save
You can’t perform that action at this time.
0 commit comments