Skip to content

release: 0.0.6

release: 0.0.6 #33

# main에 대한 pull_request가 closed될 때 workflow를 실행
on:
pull_request:
branches:
- main
types:
- closed
workflow_dispatch: #수동 실행도 가능하도록
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
# ssh로 접속하여 새로운 버전 배포
jobs:
release:
runs-on: ubuntu-latest
# pr의 결과가 merged인 경우, 혹은 수동 트리거인 경우만 job 실행
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
# ssh로 EC2 접속
- name: Connect EC2 by SSH
uses: cross-the-world/ssh-scp-ssh-pipelines@v1.1.4
with:
host: ${{ secrets.SSH_HOST }}
user: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
first_ssh: |
${{ secrets.AUTHORIZATION }}
lsof -t -i:${{ secrets.APPLICATION_PORT }} | xargs -r kill && cd ${{ secrets.PROJECT_PATH }}
git fetch && git pull
git submodule update --remote --merge
cp -r -f ./server-private/src/* ./src/
./gradlew clean build -x test
rm -f nohup.out
nohup java -jar ${{ secrets.APPLICATION_PATH }} > nohup.out 2>&1 & \
sleep 5
ps -ef | grep java
echo "Deployment completed successfully"