Skip to content

Commit

Permalink
#Git_Hub Acrtions 키방식->패스워드 방식
Browse files Browse the repository at this point in the history
  • Loading branch information
rlawltjd8547 committed Feb 3, 2025
1 parent 9405393 commit 0f64568
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,14 @@ jobs:
cd board
./gradlew build
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} # GitHub Secrets에 저장한 SSH 개인 키(공개키X)ㅛ

- name: Deploy to NCP Server # 서버 알고리즘 변경 필요 # 서버에는 공개키 등록하기
run: |
# SSH 키를 private_key.pem 파일로 저장
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key.pem
# 파일 권한 설정
chmod 600 private_key.pem

# SCP 명령어로 파일 복사
scp -o StrictHostKeyChecking=no -i private_key.pem board/build/libs/board-0.0.1-SNAPSHOT.jar [email protected]:/java

# 서버에서 .jar 파일 실행
ssh -o StrictHostKeyChecking=no -i private_key.pem [email protected] 'java -jar /java/board-0.0.1-SNAPSHOT.jar'
sudo apt-get install -y sshpass # sshpass 설치 (비밀번호 입력 자동화)
# 파일 전송 (scp)
sshpass -p "${{ secrets.SERVER_PASSWORD }}" scp -o StrictHostKeyChecking=no board/build/libs/board-0.0.1-SNAPSHOT.jar [email protected]:/java
# 작업 끝난 후 키 파일 삭제
rm private_key.pem # The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
# 서버에서 .jar 실행 (ssh)
sshpass -p "${{ secrets.SERVER_PASSWORD }}" ssh -o StrictHostKeyChecking=no [email protected] 'java -jar /java/board-0.0.1-SNAPSHOT.jar' # the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: ./gradlew publish
env:
Expand Down

0 comments on commit 0f64568

Please sign in to comment.