Skip to content

Commit a0c857a

Browse files
authored
Update server_cicd.yml
1 parent 17d9fd9 commit a0c857a

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/server_cicd.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: server CI/CD Pipeline
33

44
on:
55
push:
6-
paths:
7-
- "server/**"
86
branches:
97
- main
108

@@ -32,30 +30,39 @@ jobs:
3230
cd server
3331
./gradlew build -x test
3432
35-
- name: Deliver jar File
33+
- name: Start SSH agent
34+
uses: webfactory/[email protected]
35+
with:
36+
ssh-private-key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
37+
38+
- name: Deliver jar File through Bastion Host
3639
if: success()
3740
uses: appleboy/[email protected]
3841
with:
39-
host: ${{ secrets.GCP_SERVER_VM_HOST }}
40-
username: ${{ secrets.GCP_SERVER_VM_USER }}
41-
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
42+
host: ${{ secrets.GCP_BASTION_HOST }}
43+
username: ${{ secrets.GCP_BASTION_USER }}
44+
key: ${{ secrets.GCP_BASTION_SSH_PRIVATE_KEY }}
4245
port: 22
4346
source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar
44-
target: /home/patturning1/deployment/
47+
target: /home/patturning2/deployment/
48+
proxy_host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
49+
proxy_port: 22
4550

4651
- name: Remove unused images
4752
run: |
4853
sudo docker image prune -f
4954
50-
- name: Deploy to GCP VM
55+
- name: Deploy to Internal Server through Bastion Host
5156
if: success()
5257
uses: appleboy/[email protected]
5358
with:
5459
debug: true
55-
host: ${{ secrets.GCP_SERVER_VM_HOST }}
56-
username: ${{ secrets.GCP_SERVER_VM_USER }}
57-
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
60+
host: ${{ secrets.GCP_BASTION_HOST }}
61+
username: ${{ secrets.GCP_BASTION_USER }}
62+
key: ${{ secrets.GCP_BASTION_SSH_PRIVATE_KEY }}
5863
port: 22
64+
proxy_host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
65+
proxy_port: 22
5966
script: |
6067
sudo docker stop swdc-container || true
6168
sudo docker rm swdc-container || true

0 commit comments

Comments
 (0)