# NCP서버 SSH알고리즘 설정(서버재시작) #28
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 | |
./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 명령어에서 알고리즘을 명시적으로 지정 ㅁㄴㅇㅇ | |
scp -o StrictHostKeyChecking=no -o HostKeyAlgorithms=ssh-ed25519 -o PubkeyAcceptedAlgorithms=ssh-ed25519 board/build/libs/board-0.0.1-SNAPSHOT.jar [email protected]:/java | |
# 서버에서 .jar 파일 실행 | |
ssh -o StrictHostKeyChecking=no -o HostKeyAlgorithms=ssh-ed25519 -o PubkeyAcceptedAlgorithms=ssh-ed25519 [email protected] 'java -jar /java/board-0.0.1-SNAPSHOT.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 }} |