anonymous test #16
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 to Azure Container App | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'handlenett-backend/web-api/HandlenettAPI/**' | |
jobs: | |
build: | |
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 Azure Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.AZURE_ACR_REGISTRY_URL }} | |
username: ${{ secrets.AZURE_ACR_USERNAME }} | |
password: ${{ secrets.AZURE_ACR_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: handlenett-backend/web-api/HandlenettAPI | |
push: true | |
tags: | | |
${{ secrets.AZURE_ACR_REGISTRY_URL }}/handlenett-api:latest | |
${{ secrets.AZURE_ACR_REGISTRY_URL }}/handlenett-api:${{ github.sha }} | |
- name: Log in to Azure - App Registration Credentials | |
uses: azure/login@v1 | |
with: | |
creds: | | |
{ | |
"clientId": "${{ secrets.AZURE_CLIENT_ID_BACKEND_WEB_API }}", | |
"clientSecret": "${{ secrets.AZURE_SECRET_ID_BACKEND_WEB_API }}", | |
"subscriptionId": "${{ secrets.AZURE_SUBSCRIPTION_ID }}", | |
"tenantId": "${{ secrets.AZURE_TENANT_ID }}" | |
} | |
- name: Update Azure Container App with new image | |
run: | | |
az containerapp update --name handlenett-api --resource-group handlenett-rg \ | |
--image ${{ secrets.AZURE_ACR_REGISTRY_URL }}/handlenett-api:${{ github.sha }} \ | |
--container-name handlenett-api |