removed create namespace step #9
This file contains hidden or 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: Demo-API-CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| APP_NAME: demo-api | |
| NAMESPACE: ghdemo | |
| LOGIN_SERVER: acrjrb27045.azurecr.io | |
| CLUSTER_NAME: aks-jrb | |
| CLUSTER_RESOURCE_GROUP: aks-jrb-rg | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v2 | |
| # Connect to Azure Container Registry (ACR) | |
| - name: ACR login | |
| uses: azure/docker-login@v1 | |
| with: | |
| login-server: ${{ env.LOGIN_SERVER }} | |
| username: ${{ secrets.ACR_CLIENT_ID }} | |
| password: ${{ secrets.ACR_CLIENT_PASSWORD }} | |
| # Container build and push to a Azure Container Registry (ACR) | |
| - name: Build, tag, and push image to ACR | |
| uses: docker/build-push-action@v2 | |
| with: | |
| context: ./src | |
| file: ./src/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.LOGIN_SERVER }}/${{ env.APP_NAME }}:${{ github.run_number }} | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| # Set the target Azure Kubernetes Service (AKS) cluster. | |
| - uses: azure/aks-set-context@v1 | |
| with: | |
| creds: '${{ secrets.AZURE_CREDENTIALS }}' | |
| cluster-name: ${{ env.CLUSTER_NAME }} | |
| resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} | |
| - name: Install Helm | |
| uses: azure/setup-helm@v1 | |
| # Deploy app to AKS | |
| - name: Deploy to AKS using Helm | |
| run: | | |
| helm upgrade --install demo-api charts/demo-api \ | |
| --set image=${{ env.LOGIN_SERVER }}/${{ env.APP_NAME }}:${{ github.run_number }} \ | |
| --namespace ${{ env.NAMESPACE }} --create-namespace |