fix(ci): build 시에 checkStyle이 실행되기 때문에 불필요한 과정 제거 #38
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: Java CD with Gradle | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 | |
- name: Build with Gradle Wrapper | |
run: ./gradlew clean build -x test | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_NAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
source: ${{ secrets.SOURCE_PATH }} | |
target: ${{ secrets.DIST_PATH }} | |
- name: Execute jar file | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_NAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
script: | | |
PID=$(lsof -ti:8080) | |
if [ -n "$PID" ]; then | |
kill $PID | |
nohup java -jar ${{ secrets.JAR_FILE }} |