-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1.42 KB
/
DeployToK8S.yml
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
name: Deploy Via SSH To K8S
on:
push:
branches:
- main # Trigger on push to main branch, adjust as necessary
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: Delay for other workflows to complete and push their images to docker hub
run: sleep 240 # Sleep for 240 seconds or 4 minutes
- name: Execute commands over SSH
env:
SSH_PASSWORD: ${{ secrets.DEPLSSH_PASSWORD }}
run: |
sshpass -p $SSH_PASSWORD ssh -o StrictHostKeyChecking=no [email protected] << EOF
microk8s kubectl delete deployment --all
microk8s kubectl delete svc --all
sleep 5
microk8s ctr images remove docker.io/openvidstreamer/apigateway:latest
microk8s ctr images remove docker.io/openvidstreamer/render:latest
microk8s ctr images remove docker.io/openvidstreamer/recommendationalgo:latest
microk8s ctr images remove docker.io/openvidstreamer/account:latest
microk8s ctr images remove docker.io/openvidstreamer/videostreamer:latest
microk8s ctr images remove docker.io/openvidstreamer/videolibrary:latest
microk8s ctr images remove docker.io/openvidstreamer/upload:latest
cd ~/OpenVidStreamerKubernetesFiles
microk8s kubectl apply -f .
EOF