From a0c857af94ad24ca37cbaa958a2ae11b3eb07a7d Mon Sep 17 00:00:00 2001 From: SangYeong Park <107484383+Imsyp@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:05:16 +0900 Subject: [PATCH] Update server_cicd.yml --- .github/workflows/server_cicd.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/server_cicd.yml b/.github/workflows/server_cicd.yml index e340d8e..a54b61b 100644 --- a/.github/workflows/server_cicd.yml +++ b/.github/workflows/server_cicd.yml @@ -3,8 +3,6 @@ name: server CI/CD Pipeline on: push: - paths: - - "server/**" branches: - main @@ -32,30 +30,39 @@ jobs: cd server ./gradlew build -x test - - name: Deliver jar File + - name: Start SSH agent + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }} + + - name: Deliver jar File through Bastion Host if: success() uses: appleboy/scp-action@v0.1.5 with: - host: ${{ secrets.GCP_SERVER_VM_HOST }} - username: ${{ secrets.GCP_SERVER_VM_USER }} - key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }} + host: ${{ secrets.GCP_BASTION_HOST }} + username: ${{ secrets.GCP_BASTION_USER }} + key: ${{ secrets.GCP_BASTION_SSH_PRIVATE_KEY }} port: 22 source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar - target: /home/patturning1/deployment/ + target: /home/patturning2/deployment/ + proxy_host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }} + proxy_port: 22 - name: Remove unused images run: | sudo docker image prune -f - - name: Deploy to GCP VM + - name: Deploy to Internal Server through Bastion Host if: success() uses: appleboy/ssh-action@v0.1.3 with: debug: true - host: ${{ secrets.GCP_SERVER_VM_HOST }} - username: ${{ secrets.GCP_SERVER_VM_USER }} - key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }} + host: ${{ secrets.GCP_BASTION_HOST }} + username: ${{ secrets.GCP_BASTION_USER }} + key: ${{ secrets.GCP_BASTION_SSH_PRIVATE_KEY }} port: 22 + proxy_host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }} + proxy_port: 22 script: | sudo docker stop swdc-container || true sudo docker rm swdc-container || true