-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.67 KB
/
deploymentCD.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 }}
####