Mid Azure

How do you use GitHub Actions for deploying ASP.NET Core to Azure?

  • Create workflow YAML in .github/workflows/.
  • Use Azure WebApp Action to deploy.

name: Build and Deploy ASP.NET Core

on:

push:

branches: [ main ]

jobs:

build-and-deploy:

runs-on: ubuntu-latest

steps:

  • uses: actions/checkout@v3
  • name: Setup .NET

uses: actions/setup-dotnet@v3

with:

dotnet-version: '6.0.x'

  • name: Build

run: dotnet publish -c Release -o publish

  • name: Deploy to Azure Web App

uses: azure/webapps-deploy@v2

with:

app-name: 'my-azure-app'

publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}

package: ./publish

More from Microsoft Azure Tutorial

All questions for this course