Skip to content

Commit c45b535

Browse files
authored
Merge pull request #11 from CodezillaLK/main
Create Deployment-Prod.yml
2 parents 249bc1b + b9ca46a commit c45b535

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Millionaire-BE-CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- prod
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '20'
20+
21+
- name: Install dependencies
22+
run: sudo npm install
23+
24+
deploy:
25+
runs-on: ubuntu-latest
26+
needs: build
27+
if: github.ref == 'refs/heads/Prod'
28+
29+
steps:
30+
- name: Deploy to AWS Ubuntu
31+
uses: appleboy/ssh-action@v0.1.10
32+
with:
33+
host: ${{ secrets.AWS_HOST }}
34+
username: ubuntu
35+
key: ${{ secrets.AWS_PRIVATE_KEY }}
36+
script: |
37+
cd /home/ubuntu/Millionaire
38+
git pull origin prod
39+
sudo npm install
40+
sudo npm run build
41+
sudo systemctl reload nginx

0 commit comments

Comments
 (0)