From fcca82be71e9ca2720409f592d09c1ca5ead125f Mon Sep 17 00:00:00 2001 From: SangYeong Park <107484383+Imsyp@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:33:42 +0900 Subject: [PATCH] Update server_cicd.yml --- .github/workflows/server_cicd.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/server_cicd.yml b/.github/workflows/server_cicd.yml index 8b6904c..7920c81 100644 --- a/.github/workflows/server_cicd.yml +++ b/.github/workflows/server_cicd.yml @@ -30,6 +30,18 @@ jobs: cd server ./gradlew build -x test - - name: Deploy - if: success() - run: echo "Deploy your application here" + - name: Deploy to GCP VM + if: success() + uses: appleboy/ssh-action@v0.1.3 + with: + host: ${{ secrets.GCP_SERVER_VM_HOST }} + username: ${{ secrets.GCP_SERVER_VM_USER }} + key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }} + port: 22 + script: | + cd /home/patturning1/deployment + pkill -f swdc-0.0.1-SNAPSHOT.jar + rm -rf /home/patturning1/deployment/* + scp -r ./server/build/libs/* patturning1@34.47.71.246:/home/patturning1/deployment/ + nohup java -jar swdc-0.0.1-SNAPSHOT.jar & +