Skip to content

prod-deploy

prod-deploy #3857

Workflow file for this run

name: Build and deploy to production
on:
repository_dispatch:
types: [prod-deploy]
push:
branches:
- master
workflow_dispatch:
env:
NODE_OPTIONS: '--max_old_space_size=8192'
jobs:
build:
runs-on: 'ubuntu-latest'
outputs:
docker-image-tag: ${{ steps.generate-tag-name.outputs.docker_tag }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
with:
ref: 'master'
- name: Verify Nginx configuration
uses: addnab/docker-run-action@v3
with:
image: zilliz/z2:500969b4fa7d576d81da83ad67caef62b42571db-3981
options: -v ${{ github.workspace }}/conf/conf.d:/etc/nginx/conf.d
run: |
if nginx -t -c /etc/nginx/nginx.conf; then
echo "Nginx configuration is valid."
else
echo "Nginx configuration is invalid."
exit 1
fi
if: always()
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: update submodules
run: |
git submodule init
git submodule update --remote
- uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_PWD}}
- name: Generate docker image tag name
id: generate-tag-name
run: |
export tag=${{ github.sha }}-$GITHUB_RUN_NUMBER
echo $tag
echo "docker_tag=$tag" >> $GITHUB_OUTPUT
- name: Building Milvus site and push to docker hub
id: build-image
uses: nick-invision/retry@v2
with:
timeout_minutes: 60
max_attempts: 2
retry_on: error
command: |
docker build "$GITHUB_WORKSPACE/" -f "Builder.Dockerfile" \
--build-arg MSERVICE_URL=${{ secrets.MSERVICE_URL }} \
--build-arg CMS_BASE_URL=${{ secrets.CMS_BASE_URL }} \
--build-arg REPO_STATICS_KEY=${{ secrets.REPO_STATICS_KEY }} \
--build-arg INKEEP_API_KEY=${{ secrets.INKEEP_API_KEY }} \
--build-arg INKEEP_INTEGRATION_ID=${{ secrets.INKEEP_INTEGRATION_ID }} \
--build-arg INKEEP_ORGANIZATION_ID=${{ secrets.INKEEP_ORGANIZATION_ID }} \
-t milvusdb/milvus-io-dev:${{ steps.generate-tag-name.outputs.docker_tag }}
docker push milvusdb/milvus-io-dev:${{ steps.generate-tag-name.outputs.docker_tag }}
# env:
# GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true
# CI: true
deploy:
runs-on: amazon-linux-2
needs: build
steps:
- name: Deploy to cluster
run: |
echo ${{ secrets.kubeconfig }} > config64
base64 -d config64 > kubeconfig
kubectl set image deployment/milvus-io-prod milvus-io-prod=milvusdb/milvus-io-dev:${{ needs.build.outputs.docker-image-tag }} -n ued --kubeconfig=kubeconfig