Skip to content

refactor(github) : source 값을 정적으로 변경 #10

refactor(github) : source 값을 정적으로 변경

refactor(github) : source 값을 정적으로 변경 #10

Workflow file for this run

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: "build/libs"
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 }}