Skip to content

Deploy to Azure App Service #174

Deploy to Azure App Service

Deploy to Azure App Service #174

Workflow file for this run

name: Deploy to Azure App Service
on:
push:
branches:
- main
workflow_dispatch:
inputs:
# .NET 8 disabled - uncomment to re-enable:
# deploy_net8:
# description: 'Deploy .NET 8 version'
# type: boolean
# default: true
deploy_net10:
description: 'Deploy .NET 10 version'
type: boolean
default: true
env:
# App Service names - update these to match your Azure resources
# .NET 8 disabled - uncomment to re-enable:
# AZURE_WEBAPP_NET8: perfsimdotnet8
AZURE_WEBAPP_NET10: PerfSimDotNet
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# .NET 8 disabled - uncomment to re-enable:
# - framework: net8.0
# dotnet-version: '8.0.x'
# artifact-name: publish-net8
- framework: net10.0
dotnet-version: '10.0.x'
artifact-name: publish-net10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore src/PerfProblemSimulator/PerfProblemSimulator.csproj
- name: Build (${{ matrix.framework }})
run: dotnet build src/PerfProblemSimulator/PerfProblemSimulator.csproj --configuration Release --framework ${{ matrix.framework }} --no-restore
- name: Publish (${{ matrix.framework }})
run: dotnet publish src/PerfProblemSimulator/PerfProblemSimulator.csproj --configuration Release --framework ${{ matrix.framework }} --no-build --output ./publish
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ./publish
# .NET 8 deployment disabled - uncomment to re-enable:
# deploy-net8:
# needs: build
# runs-on: ubuntu-latest
# if: github.event_name == 'push' || github.event.inputs.deploy_net8 == 'true'
#
# steps:
# - name: Download .NET 8 artifact
# uses: actions/download-artifact@v4
# with:
# name: publish-net8
# path: ./publish-net8
#
# - name: Login to Azure
# uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
#
# - name: Deploy to Azure Web App (.NET 8)
# uses: azure/webapps-deploy@v3
# with:
# app-name: ${{ env.AZURE_WEBAPP_NET8 }}
# package: ./publish-net8
deploy-net10:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.inputs.deploy_net10 == 'true'
steps:
- name: Download .NET 10 artifact
uses: actions/download-artifact@v4
with:
name: publish-net10
path: ./publish-net10
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to Azure Web App (.NET 10)
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NET10 }}
package: ./publish-net10