-
Notifications
You must be signed in to change notification settings - Fork 6
47 lines (38 loc) Β· 1.32 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
name: ssh for release deploy
on:
push:
branches: [ develop ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: SSH Remote Commands
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
timeout: 40s
script: |
echo "1. project rootλ‘ μ΄λ"
cd ~/livable/server
echo "2. git pull"
git pull origin develop
echo "3. project build"
./gradlew clean build
if [ $? -eq 0 ]; then
# λΉλ μ±κ³΅ μ
echo "4. μ€νμ€μΈ νλ‘μΈμ€ νμΈ"
CURRENT_PID=$(pgrep -f ${{ secrets.PROJECT_ROOT }}/build/libs/server-0.0.1-SNAPSHOT.jar)
echo "5. μ€νμ€μΈ νλ‘μΈμ€ μ€μ§"
sudo kill -9 $CURRENT_PID
echo "6. ν κ²½λ‘ μ΄λ ν νλ‘μ νΈ μ¬μ€ν"
cd ~
nohup java -jar ${{ secrets.PROJECT_ROOT }}/build/libs/server-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod > nohup.out 2> nohup.err < /dev/null &
else
echo "νλ‘μ νΈ Build μ€ν¨"
exit 1
fi