-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (51 loc) ยท 1.74 KB
/
master_weekly_cicd.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
name: master ๋ฐ weekly ๋ธ๋์น merge ์ CI/CD ํ์ดํ๋ผ์ธ
on:
push:
branches:
- 'master'
- 'weekly/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: ํ๋ก์ ํธ ์ฝ๋๋ฅผ CI ์๋ฒ๋ก ์ฎ๊ฒจ์ค๊ธฐ
uses: actions/checkout@v4
- name: JDK 21 ์ค์น
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- name: AWS S3 ๊ด๋ จ ์ ๋ณด๋ฅผ ์ค์ ํ์ผ์ ์ฃผ์
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-prod.yml
env:
aws.s3.bucket: ${{ secrets.AWS_S3_BUCKET }}
aws.s3.accessKey: ${{ secrets.AWS_S3_ACCESS_KEY }}
aws.s3.secretKey: ${{ secrets.AWS_S3_SECRET_KEY }}
- name: ๋น๋๋ก ํ
์คํธ ์ํ ๋ฐ Jar ํ์ผ ์์ฑ
run: |
chmod +x ./gradlew
./gradlew clean build
mv build/libs/*SNAPSHOT.jar ./app.jar
- name: ์์ฑ๋ Jar ํ์ผ EC2 ์๋ฒ๋ก ์ ์กํ๊ธฐ
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
script_stop: true
overwrite: true
source: app.jar
target: /home/ubuntu/project
- name: EC2 ์๋ฒ์ ์ ์ํ๊ธฐ(SSH) ๋ฐ ์คํ๋ง ์๋ฒ ์คํ
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
script_stop: true
script: |
cd ./project
sudo fuser -k -n tcp 8080 || true
nohup java -jar app.jar > ./output.log 2>&1 &