-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.74 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Deploy to EC2
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [18.12.1]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# build_args: REACT_APP_ADMIN_KEY=${{ secrets.REACT_APP_ADMIN_KEY }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up environment variable
run: echo "REACT_APP_API=${{ secrets.REACT_APP_API }}" >> .env
- name: Install dependencies and build
run: |
npm install --save --legacy-peer-deps
npm run build
- name: zip create # S3에 올릴 zip 파일 생성. (빌드한 프로젝트를 압축)
run: zip -qq -r ./build.zip .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pcot-web-artifact
path: build.zip
deploy:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: pcot-web-artifact
- name: Transfer Deploy Script use SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.WEB_HOST_ID }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.PRIVATE_KEY }}
source: "*.zip"
target: "~/"
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WEB_HOST_ID }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
sh /home/ubuntu/deploy.sh