-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.28 KB
/
main.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
55
56
name: Next.js CI/CD
on:
push:
branches:
- main
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: create .env file
shell: bash
run: |
touch .env
echo "${{secrets.env}}" > .env
- name: Install and Build 🔧
run: |
yarn install
yarn build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: connect EC2 instance, Pull recent version of GitHub and start yarn
uses: appleboy/[email protected]
with:
host: ${{ secrets.AWS_EC2_HOST_IP }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
pm2 stop yarn
pm2 delete yarn
cd /home/ubuntu
rm -rf Menjil-FE
git clone https://github.com/Menjil-Menjil/Menjil-FE.git
cd Menjil-FE
touch .env
echo "${{secrets.env}}" > .env
yarn install
yarn build
pm2 start yarn -- start
# sudo docker-compose down
# sudo docker system prune -a -f
# sudo docker-compose up -d