Merge pull request #12 from kakao-tech-campus-2nd-step3/weekly/3 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/scp-action@v0.1.7 | |
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/ssh-action@v1.0.3 | |
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 & |