Skip to content

Commit

Permalink
Merge pull request #11 from kakao-tech-campus-2nd-step3/feature/10-cicd
Browse files Browse the repository at this point in the history
feat: Github Actions๋กœ CI/CD ์ž๋™ ๋ฐฐํฌ ๊ตฌ์ถ•
  • Loading branch information
peeerr authored Sep 20, 2024
2 parents c5f019b + defb1ac commit 4da8842
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: master ๋ธŒ๋žœ์น˜ ์ž๋™ ๋ฐฐํฌ

on:
push:
branches:
- 'master'

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: ๋นŒ๋“œ๋กœ ํ…Œ์ŠคํŠธ ์ˆ˜ํ–‰ ๋ฐ Jar ํŒŒ์ผ ์ƒ์„ฑ
run: |
./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 &
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@JsonInclude(Include.NON_NULL)
public class SuccessResponse<T> {

private int code;
private String message;
private T info;

Expand Down

0 comments on commit 4da8842

Please sign in to comment.