Skip to content

test: git actions server test 1 #114

test: git actions server test 1

test: git actions server test 1 #114

Workflow file for this run

# .github/workflows/ci-cd.yml
name: server CI/CD Pipeline
on:
push:
# paths:
# - "server/build/libs/**"
branches:
- main
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Deliver jar File to Internal Server through Bastion Host
# env:
# GCE_USER_HOME: ${{ secrets.GCE_USER_HOME }}
# if: success()
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
# username: ${{ secrets.GCP_SERVER_VM_USER }}
# key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
# proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
# proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
# proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
# source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar
# target: ${{ secrets.GCE_USER_HOME }}/deployment/
# - name: Deploy to Internal Server through Bastion Host
# env:
# GCE_USER_HOME: ${{ secrets.GCE_USER_HOME }}
# if: success()
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.GCP_INTERNAL_SERVER_VM_HOST }}
# username: ${{ secrets.GCP_SERVER_VM_USER }}
# key: ${{ secrets.GCP_INTERNAL_SERVER_SSH_PRIVATE_KEY }}
# port: 22
# proxy_host: ${{ secrets.GCP_SERVER_VM_HOST }}
# proxy_username: ${{ secrets.GCP_SERVER_VM_USER }}
# proxy_key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
# proxy_port: 22
# script: |
# sudo docker image prune -f
# sudo docker stop swdc-container || true
# sudo docker rm swdc-container || true
# cd ${{ secrets.GCE_USER_HOME }}/deployment
# sudo docker build -t swdc-app .
# sudo docker run -d -p 8080:8080 --name swdc-container -v /mnt:/mnt swdc-app
- name: Deliver jar File to server
env:
GCE_USER_HOME: ${{ secrets.GCE_USER_HOME }}
if: success()
uses: appleboy/[email protected]
with:
host: ${{ secrets.GCP_SERVER_VM_HOST }}
username: ${{ secrets.GCP_SERVER_VM_USER }}
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
source: server/build/libs/swdc-0.0.1-SNAPSHOT.jar
target: ${{ secrets.GCE_USER_HOME }}/deployment/
- name: Deploy to Server
env:
GCE_USER_HOME: ${{ secrets.GCE_USER_HOME }}
if: success()
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.GCP_SERVER_VM_HOST }}
username: ${{ secrets.GCP_SERVER_VM_USER }}
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
port: 22
script: |
sudo docker image prune -f
sudo docker stop swdc-container || true
sudo docker rm swdc-container || true
cd ${{ secrets.GCE_USER_HOME }}/deployment
sudo docker build -t swdc-app .
sudo docker run -d -p 8080:8080 --name swdc-container -v /mnt:/mnt swdc-app