-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.32 KB
/
aws.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
57
name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14.21.3'
cache: 'npm'
- name: Upgrade npm
run: npm install -g npm@latest
- name: Clear npm cache
run: npm cache clean --force
- name: Remove node_modules
run: rm -rf node_modules
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Copy files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
port: 22
source: "build/*"
target: "~/resview-pvt"
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
port: 22
script: |
pm2 delete resview || true
cd ~/resview-pvt
npm install -g http-server
pm2 start http-server --name "resview-pvt" -- -p 7500 -c-1 ./build
pm2 save