Skip to content

Workflow file for this run

name: Deploy to SBIP Server
on:
push:
branches:
- cd
jobs:
deploy-to-g2-server:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: VPN into SoC network
run: |
sudo apt update && sudo apt install -y openconnect
echo "${{ secrets.SOC_VPN_PASSWORD }}" | sudo openconnect --protocol=fortinet staffvpn.comp.nus.edu.sg -u ${{ secrets.SOC_VPN_USERNAME }} --passwd-on-stdin --background
echo OPENCONNECT_PID=$(pgrep -f openconnect) > $GITHUB_ENV
- name: SSH into SBIP Server and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
ssh worker-111 "cd mec_anywhere && git checkout cd && git pull && docker compose -f docker-compose-sbip.yaml build && docker compose -f docker-compose-sbip.yaml up -d"
- name: Disconnect vpn
if: always()
run: |
sudo kill ${{ env.OPENCONNECT_PID }}