Delete src/main/resources/application-test.yml #19
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 : Deploy to EC2 | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Deploy-Job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Repository에 올린 파일들을 불러오기 | |
uses: actions/checkout@v4 | |
- name: JDK 17버전 설치 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: application.yml 파일 만들기 | |
run: echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./src/main/resources/application.yml | |
- name: 테스트 및 빌드 | |
run: ./gradlew clean build -Dspring.profiles.active=test | |
- name: 빌드된 파일 이름 변경 | |
run: mv ./build/libs/*SNAPSHOT.jar ./project.jar | |
- name: SCP로 EC2에 빌드된 파일 전송 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
source: project.jar | |
target: /home/ubuntu/concurrencyPrac/tobe | |
- name: SSH 접속 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST}} | |
username: ${{ secrets.EC2_USERNAME}} | |
key: ${{ secrets.EC2_PRIVATE_KEY}} | |
script_stop: true | |
script: | | |
rm -rf /home/ubuntu/concurrencyPrac/current | |
mkdir /home/ubuntu/concurrencyPrac/current | |
mv /home/ubuntu/concurrencyPrac/tobe/project.jar /home/ubuntu/concurrencyPrac/current/project.jar | |
cd /home/ubuntu/concurrencyPrac/current | |
sudo fuser -k -n tcp 8080 || true | |
nohup java -jar project.jar > ./output.log 2>&1 & | |
rm -rf /home/ubuntu/concurrencyPrac/tobe | |