Merge pull request #77 from dajeongdev/refactor/jwt #35
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: Auto Deploy | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
# checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# JDK setting | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
# secret yml file 생성 | |
- name: Set secret yml | |
run: | | |
mkdir -p src/main/resources | |
echo "${{ secrets.DATABASE_YML }}" | base64 --decode > src/main/resources/application-database.yml | |
echo "${{ secrets.NAVER_TOKEN_YML }}" | base64 --decode > src/main/resources/application-naver-token.yml | |
echo "${{ secrets.SECURITY_YML }}" | base64 --decode > src/main/resources/application-security.yml | |
find src | |
shell: bash | |
# Gradle 권한 부여 | |
- name: Grant permission for gradlew | |
run: chmod +x ./gradlew | |
# 테스트 없이 빌드 | |
- name: Build with Gradle | |
run: ./gradlew clean build -x test | |
# 포트가 사용 중이라면 종료 | |
- name: Kill 8009 port if exist | |
run: | | |
if sudo lsof -i :8009; then | |
echo "Port 8009 is already in use. Killing the process..." | |
sudo kill -9 `sudo lsof -t -i:8009` | |
fi | |
# Jar 파일 실행 | |
- name: Execute Jar File | |
run: | | |
sudo nohup java -jar build/libs/americano-0.0.1-SNAPSHOT.jar 1>/root/nohup/output.log 2>/root/nohup/error.log & | |
sleep 10 |