Skip to content

Add or update the Azure App Service build and deployment workflow config #13

Add or update the Azure App Service build and deployment workflow config

Add or update the Azure App Service build and deployment workflow config #13

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy container app to Azure Web App - andre-emotion-app
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to container registry
uses: docker/login-action@v2
with:
registry: index.docker.io/
username: ${{ secrets.AZUREAPPSERVICE_CONTAINERUSERNAME_B4073360D65847249F5FB4CB38D98087 }}
password: ${{ secrets.AZUREAPPSERVICE_CONTAINERPASSWORD_3C61B47018394C7DA55735691DACD110 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: index.docker.io/${{ secrets.AZUREAPPSERVICE_CONTAINERUSERNAME_B4073360D65847249F5FB4CB38D98087 }}/emotion-app:${{ github.sha }}
file: ./Dockerfile
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
needs: build
steps:
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_AF72259B2444479B9D4C55E5B709F9C1 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_95E26C4B93DE49CFAACC4E5118D6A90C }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_E2DB3D22B4F3422993D7F11B8031EDA5 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'andre-emotion-app'
slot-name: 'Production'
images: 'index.docker.io/${{ secrets.AZUREAPPSERVICE_CONTAINERUSERNAME_B4073360D65847249F5FB4CB38D98087 }}/emotion-app:${{ github.sha }}'