Build and deploy ASP.Net Core app to Azure Web App - MitelksHome #15
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 ASP.Net Core app to Azure Web App - MitelksHome | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x' | |
- name: Build with dotnet | |
run: dotnet build MainPage2/MainPage2.csproj --configuration Release | |
- name: dotnet publish | |
run: dotnet publish MainPage2/MainPage2.csproj -c Release -o ${{ runner.temp }}/myapp | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: .net-app | |
path: ${{ runner.temp }}/myapp | |
deploy: | |
runs-on: windows-latest | |
needs: build | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
permissions: | |
id-token: write | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: .net-app | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6DDF1166E4914473ADD6D15E678B57B2 }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_C358623F78F3403AB630E64ADA398C2A }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_86B1D7AD2FC74A7192A1B29297286205 }} | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'MitelksHome' | |
slot-name: 'Production' | |
package: ${{ runner.temp }}/myapp |