Merge pull request #33 from zilliztech/refactor_2 #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |