Skip to content

# NCP서버 SSH알고리즘 설정(서버재시작) #24

# NCP서버 SSH알고리즘 설정(서버재시작)

# NCP서버 SSH알고리즘 설정(서버재시작) #24

# 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
./gradlew build
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} # GitHub Secrets에 저장한 SSH 개인 키(공개키X)
- name: Add NCP server to known hosts
run: |
ssh-keyscan -H 175.45.192.108 >> ~/.ssh/known_hosts
- name: Deploy to NCP Server # 서버 알고리즘 변경 필요 # 서버에는 공개키 등록하기
run: |
scp -o StrictHostKeyChecking=no board/build/libs/board-0.0.1-SNAPSHOT.jar [email protected]:/java
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 }}