Skip to content

Commit 1c3d72e

Browse files
committed
chore: 스크립트 수정2
1 parent 75d6d85 commit 1c3d72e

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,31 @@ jobs:
4747
script: |
4848
cd /home/ubuntu/app
4949
50+
echo "[deploy] kill old app if exists"
51+
pkill -f "java -jar" || true
52+
sleep 5
53+
54+
echo "[deploy] list jars"
55+
ls -al build/libs
56+
57+
JAR_PATH=$(ls -t build/libs/*.jar | head -n 1)
58+
echo "[deploy] Using JAR: $JAR_PATH"
59+
60+
if [ -z "$JAR_PATH" ]; then
61+
echo "[deploy] No JAR found under build/libs"
62+
exit 1
63+
fi
64+
65+
echo "[deploy] start app with nohup in background"
5066
DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
51-
java -jar build/libs/*-SNAPSHOT.jar
67+
nohup java -jar "$JAR_PATH" > app.log 2>&1 &
68+
69+
sleep 5
70+
71+
if pgrep -f "java -jar" > /dev/null; then
72+
echo "[deploy] Application is running."
73+
exit 0
74+
else
75+
echo "[deploy] Application failed to start."
76+
exit 1
77+
fi

0 commit comments

Comments
 (0)