We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75d6d85 commit 1c3d72eCopy full SHA for 1c3d72e
1 file changed
.github/workflows/deploy.yml
@@ -47,5 +47,31 @@ jobs:
47
script: |
48
cd /home/ubuntu/app
49
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"
66
DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
- java -jar build/libs/*-SNAPSHOT.jar
67
+ nohup java -jar "$JAR_PATH" > app.log 2>&1 &
68
69
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
77
0 commit comments