MATE-85 : [FIX] deploy.yml gradlew 권한 부여후 시도 #10
Workflow file for this run
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 | |
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: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- 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 & |