Skip to content

Commit

Permalink
Update server_cicd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Imsyp authored Oct 10, 2024
1 parent 17d9fd9 commit a0c857a
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/server_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: server CI/CD Pipeline

on:
push:
paths:
- "server/**"
branches:
- main

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a0c857a

Please sign in to comment.