Updating Workflow #1
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 and deploy apps to AKS with Helm | |
on: | |
push: | |
branches: main | |
workflow_dispatch: | |
env: | |
AZURE_CONTAINER_REGISTRY: "loveofsports.azurecr.io" | |
RESOURCE_GROUP: "LoveofSports-Dev" | |
CLUSTER_NAME: "DevCluster" | |
CHART_PATH: "azure-service-operator/Chart.yaml" | |
CHART_OVERRIDE_PATH: "your-chart-override-path" | |
jobs: | |
buildImage: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Azure login | |
uses: azure/[email protected] | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Build and push frontend image to ACR | |
run: | | |
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/ssweb-frontend:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} . | |
- name: Build and push backend image to ACR | |
run: | | |
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/python:3.9.18:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} . | |
deploy: | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: [buildImage] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Azure login | |
uses: azure/[email protected] | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Set up kubelogin for non-interactive login | |
uses: azure/use-kubelogin@v1 | |
with: | |
kubelogin-version: 'v0.0.25' | |
- name: Get K8s context | |
uses: azure/aks-set-context@v3 | |
with: | |
resource-group: ${{ env.RESOURCE_GROUP }} | |
cluster-name: ${{ env.CLUSTER_NAME }} | |
admin: 'false' | |
use-kubelogin: 'true' | |
- name: Bake deployment | |
uses: azure/k8s-bake@v2 | |
with: | |
renderEngine: "helm" | |
helmChart: ${{ env.CHART_PATH }} | |
overrideFiles: ${{ env.CHART_OVERRIDE_PATH }} | |
overrides: | | |
replicas:2 | |
helm-version: "latest" | |
id: bake | |
- name: Deploy application | |
uses: Azure/k8s-deploy@v4 | |
with: | |
action: deploy | |
manifests: ${{ steps.bake.outputs.manifestsBundle }} | |
images: | | |
${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/ssweb-frontend:${{ github.sha }} | |
${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/python:3.9.18:${{ github.sha }} |