-
Notifications
You must be signed in to change notification settings - Fork 9
53 lines (46 loc) · 1.91 KB
/
prod.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@master
- name: Install OpenVPN and kubectl
run: |
sudo apt-get update
sudo apt-get install openvpn -y
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install kubectl -y
- name: Connect VPN
uses: golfzaptw/action-connect-ovpn@master
id: connect_vpn
with:
FILE_OVPN: '.github/workflows/client.ovpn'
env:
CA_CRT: ${{ secrets.VPN_CA}}
USER_CRT: ${{ secrets.VPN_CRT }}
USER_KEY: ${{ secrets.VPN_KEY }}
- uses: azure/docker-login@v1
with:
login-server: harbor-us1.zilliz.cc
username: ${{ secrets.HARBOR_US1_UED_USERNAME }}
password: ${{ secrets.HARBOR_US1_UED_PWD }}
- name: Build image
id: build-image
run: |
./convert.sh && docker build "$GITHUB_WORKSPACE/" -f "Dockerfile" -t harbor-us1.zilliz.cc/ued/milvus-codelabs:${{ github.sha }}
- name: Push image to Harbor
id: push-image
run: |
docker push harbor-us1.zilliz.cc/ued/milvus-codelabs:${{ github.sha }}
- name: Deploy to cluster
run: |
echo ${{ secrets.UED_KUBECONFIG }} > config64
base64 -d config64 > kubeconfig
kubectl set image deployment/milvus-codelabs milvus-codelabs=harbor-us1.zilliz.cc/ued/milvus-codelabs:${{ github.sha }} -n ued --kubeconfig=kubeconfig