Skip to content

Continuous Deployment for Comment Service #128

Continuous Deployment for Comment Service

Continuous Deployment for Comment Service #128

Workflow file for this run

name: Continuous Deployment for Comment Service
on:
workflow_run:
workflows: ["Continuous Integration for Comment Service"]
types:
- completed
jobs:
deploy:
name: Deploy to GKE Autopilot
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Install OpenVPN
run: sudo apt-get update && sudo apt-get install -y openvpn
- name: Connect to VPN
env:
VPN_USERNAME: ${{ secrets.VPN_USERNAME }}
VPN_PASSWORD: ${{ secrets.VPN_PASSWORD }}
run: |
echo "${{ secrets.VPN_PROFILE_BASE64 }}" | base64 --decode > profile-559.ovpn
echo -e "${VPN_USERNAME}\n${VPN_PASSWORD}" > vpn-auth.txt
sudo openvpn --config profile-559.ovpn --auth-user-pass vpn-auth.txt --daemon
sleep 10
rm vpn-auth.txt
rm profile-559.ovpn
- name: Deploy to Server
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd /home/ubuntu/K8S
sudo kubectl apply -f comment-mongo-deployment.yaml
sudo kubectl apply -f comment-service-deployment.yaml
# - name: Apply Kubernetes manifests
# run: |
# kubectl apply -f resources.yaml
notify:
needs: deploy
uses: ./.github/workflows/notifyCD.yaml
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
####