-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (40 loc) · 1.42 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: 배포
on:
push:
branches: [main, deploy/33-BE_cd]
workflow_dispatch:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: execute remote ssh
uses: appleboy/ssh-action@master
env:
REMOTE_SSH_PASSWORD: ${{ secrets.REMOTE_SSH_PASSWORD }}
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
password: ${{ secrets.REMOTE_SSH_PASSWORD }}
port: ${{ secrets.REMOTE_SSH_PORT }}
envs: BRANCH_NAME, REMOTE_SSH_PASSWORD
script_stop: true
script: |
echo $BRANCH_NAME
cd workspaces/1day1baek/back
git reset --hard HEAD
echo 11111111111111111111111111111111111111111
git checkout -B $BRANCH_NAME
git pull origin $BRANCH_NAME
echo 2222222222222222222222222222222222
server_process=$(ps -ef | grep OneDayOneBaek-0.0.1-SNAPSHOT.jar$)
echo 333333333333333333333333333333333
if [ -n "$server_process" ]; then
server_pid=(${server_process// / })
server_pid=${server_pid[1]}
echo "existed server pid : $server_pid"
echo $REMOTE_SSH_PASSWORD | sudo -S kill -9 $server_pid
fi
./run_sandbox.sh