Skip to content

MATE-85 : [FIX] deploy.yml 변경하여 배포 시도 #9

MATE-85 : [FIX] deploy.yml 변경하여 배포 시도

MATE-85 : [FIX] deploy.yml 변경하여 배포 시도 #9

Workflow file for this run

name: Deploy To EC2
on:
push
jobs:
deploy:
runs-on: ubuntu-latest
env:
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
OPENWEATHER_API_KEY: ${{ secrets.OPENWEATHER_API_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew clean build
- name: SSH로 EC2에 접속하기
uses: appleboy/[email protected]
env:
APPLICATION_PROPERTIES: ${{ secrets.APPLICATION_PROPERTIES }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: |
APPLICATION_PROPERTIES
NAVER_CLIENT_ID
NAVER_REDIRECT_URI
NAVER_CLIENT_SECRET
JWT_SECRET_KEY
OPENWEATHER_API_KEY
script_stop: true
script: |
cd /home/ubuntu/WEB1_2_PitchingMate_BE
git pull origin develop
echo "$APPLICATION_PROPERTIES" > src/main/resources/application-dev.yml
./gradlew clean build
sudo fuser -k -n tcp 8080 || true
nohup java -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 &