Merge pull request #249 from gen-mind/develop #9
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
name: Build semantic service | |
# on: | |
# push: | |
# tags: | |
# - '*' | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/backend/semantic/**' | |
- '.github/workflows/semantic-build.yml' | |
env: | |
# Use docker.io for Docker Hub if empty | |
#REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
#IMAGE_NAME: ${{ github.repository }} | |
RGNAME: AKS_RG | |
ACRNAME: cognixacr | |
AKSNAME: Cognix_AKS | |
GITHUB_SHA: ${{ github.sha }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to ACR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.ACRNAME }}.azurecr.io | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Embedder Service Image Docker Build and Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./src/backend/semantic | |
file: ./src/backend/semantic/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
${{ env.ACRNAME }}.azurecr.io/cognix/semantic:${{env.GITHUB_SHA}} | |
build-args: | | |
COGNIX_VERSION=${{env.GITHUB_SHA}} | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Get AKS kubeconfig | |
run: az aks get-credentials --resource-group $RGNAME --name $AKSNAME | |
- name: Update Semantic server manifest | |
run: | |
sed -ie "s/semantic:main/semantic:${{env.GITHUB_SHA}}/g" ./src/backend/semantic/semantic-deployment.yaml | |
- name: Deploy Semantic server manifest | |
run: | | |
kubectl apply -f ./src/backend/semantic/semantic-deployment.yaml | |
- name: Delete Semantic server pod | |
run: | | |
kubectl rollout restart deploy/semantic |