From 068e497f309e486f71e119dabb9c903867f233f6 Mon Sep 17 00:00:00 2001 From: ZeinebMESSAOUDI <130365664+Zeineb2001@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:54:52 +0100 Subject: [PATCH] Update Cart-ci-cd.yml --- .github/workflows/Cart-ci-cd.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Cart-ci-cd.yml b/.github/workflows/Cart-ci-cd.yml index afb21700..eb28b614 100644 --- a/.github/workflows/Cart-ci-cd.yml +++ b/.github/workflows/Cart-ci-cd.yml @@ -76,7 +76,12 @@ jobs: run: | sshpass -p "${{ secrets.DEPLOYMENT_MACHINE_USER_PSW }}" ssh ${{ secrets.DEPLOYMENT_MACHINE_USER }}@${{ secrets.DEPLOYMENT_MACHINE_IP }} \ "df -h && free -h && top -bn1 | grep 'Cpu(s)'" - + + - name: Kill Process on Port 8081 (if any) + run: | + sshpass -p "${{ secrets.DEPLOYMENT_MACHINE_USER_PSW }}" ssh ${{ secrets.DEPLOYMENT_MACHINE_USER }}@${{ secrets.DEPLOYMENT_MACHINE_IP }} \ + "fuser -k 8081/tcp || echo 'No process on port 8081'" + - name: Deploy JAR to VPS uses: appleboy/ssh-action@v0.1.2 with: @@ -86,10 +91,10 @@ jobs: script: | sleep 10 - echo "Starting Spring Boot service..." + echo "Starting java service..." cd ~/Cart nohup java -jar cart-project.jar --server.port=8081 > cart-project.log 2>&1 & - echo "Spring Boot service deployed successfully!" + echo "java service deployed successfully!" sleep 30