-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (40 loc) · 1.75 KB
/
cd-dev.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: Java CD with Gradle - Dev
on:
push:
branches: [ "dev" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Connect to EC2 via SSH
uses: appleboy/ssh-action@master
env:
DEV_APPLICATION_YML: ${{ secrets.DEV_APPLICATION_YML }}
APPLICATION_TEST_YML: ${{ secrets.APPLICATION_TEST_YML }}
TEST_DATA_SQL: ${{ secrets.TEST_DATA_SQL }}
FIREBASE_ADMIN: ${{ secrets.FIREBASE_ADMIN }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script_stop: true
envs: DEV_APPLICATION_YML, APPLICATION_TEST_YML, TEST_DATA_SQL, FIREBASE_ADMIN
# git clone 같은 초기 작업은 ec2에서 먼저 진행
script: |
cd /home/ubuntu/poptato_server/Poptato_Server_Dev
git switch dev
git pull origin dev
rm -rf src/main/resources/application.yml
mkdir -p src/main/resources
echo "$DEV_APPLICATION_YML" > src/main/resources/application.yml
rm -rf src/test/resources/application.yml
mkdir -p src/test/resources
echo "$APPLICATION_TEST_YML" > src/test/resources/application.yml
rm -rf src/test/resources/data.sql
echo "$TEST_DATA_SQL" > src/test/resources/data.sql
echo "$FIREBASE_ADMIN" > ildan-project-firebase-adminsdk-rcb58-766d3dd75f.json
chmod +x gradlew
./gradlew clean
./gradlew build
sudo fuser -k -n tcp "${{ secrets.DEV_SERVER_PORT }}" || true
nohup java -Duser.timezone=Asia/Seoul -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 &