-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (46 loc) · 1.64 KB
/
dev_code_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
name: Dev code deploy
on:
push:
branches: [ "dev2" ]
pull_request:
branches: [ "dev2" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # 또는 프로젝트에서 사용하는 Node.js 버전
- name: Install dependencies
run: |
cd front
npm install
- name: Make deploy script executable
run: chmod +x ./deploy.sh
- name: Run deploy script
run: ./deploy.sh
- name: Add SSH fixkey to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.DEV_TWO_TOMCAT_SSH_HOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.DEV_TWO_ASYNC_SSH_HOST }} >> ~/.ssh/known_hosts
- name: Create SSH key
run: |
echo "${{ secrets.PEM_KEY }}" > private_key
chmod 600 private_key
- name: Deploy To EC2
env:
ACTIVE_PROFILE: dev
run: |
scp -i private_key ./api/build/libs/*.jar ${{ secrets.DEV_TWO_TOMCAT_SSH_FULL_INFO }}:~/
scp -i private_key ./consumer/build/libs/*.jar ${{ secrets.DEV_TWO_ASYNC_SSH_FULL_INFO }}:~/
ssh -i private_key ${{ secrets.DEV_TWO_TOMCAT_SSH_FULL_INFO }} "sudo bash ${{ secrets.SCRIPT_PATH }} $ACTIVE_PROFILE"
ssh -i private_key ${{ secrets.DEV_TWO_ASYNC_SSH_FULL_INFO }} "sudo bash ${{ secrets.SCRIPT_PATH }} $ACTIVE_PROFILE"