# 경로찾기 #14
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
name: HighFunction CI/CD | |
on: | |
push: | |
branches: | |
- main # main 브랜치에 푸시될 때마다 실행 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./board/gradlew | |
- name: Build with Gradle | |
run: | | |
cd board # 'board' 디렉토리로 이동 | |
./gradlew build # Windows에서 gradlew.bat 사용해 빌드 | |
- name: Check build directory | |
run: ls -R ./build/ | |
- name: Check build directory | |
run: | | |
ls -R ./build/ | |
# 또는 find 명령어로 .jar 파일 찾기 | |
find . -name "*.jar" | |
- name: Check build directory | |
run: ls -R ./build/libs | |
- name: Check build directory | |
run: | | |
ls -R ./build/libs | |
# 또는 find 명령어로 .jar 파일 찾기 | |
find . -name "*.jar" | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} # GitHub Secrets에 저장한 SSH 개인 키 | |
- name: Deploy to NCP Server | |
run: | | |
scp -o StrictHostKeyChecking=no ./build/libs/board-0.0.1-SNAPSHOT.jar [email protected]:/java # .jar 파일을 NCP 서버로 복사 | |
ssh -o StrictHostKeyChecking=no [email protected] 'java -jar /java/board-0.0.1-SNAPSHOT.jar' # 서버에서 .jar 파일 실행 | |
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in | |
# the publishing section of your build.gradle | |
- name: Publish to GitHub Packages | |
run: ./gradlew publish | |
env: | |
USERNAME: ${{ github.actor }} | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} |