Skip to content

Bump Microsoft.AspNetCore.Components.WebAssembly.Server #18

Bump Microsoft.AspNetCore.Components.WebAssembly.Server

Bump Microsoft.AspNetCore.Components.WebAssembly.Server #18

Workflow file for this run

name: eShopOnWeb Build and Test
#Triggers (uncomment line below to use it)
on: [push, workflow_dispatch]
#Environment variables https://docs.github.com/en/actions/learn-github-actions/environment-variables
env:
RESOURCE-GROUP: rg-eshoponweb-Training
LOCATION: eastus
TEMPLATE-FILE: infra/webapp.bicep
SUBSCRIPTION-ID: 7f3a215f-a23a-44ff-96b1-8b750edcbad1
WEBAPP-NAME: eshoponweb-webapp-AzTraining
jobs:
#Build, test and publish .net web project in repository
buildandtest:
runs-on: windows-latest
steps:
#checkout the repository
- uses: actions/checkout@v4
#prepare runner for desired .net version SDK
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
include-prerelease: true
#Build/Test/Publish the .net project
- name: Build with dotnet
run: dotnet build ./eShopOnWeb.sln --configuration Release
- name: Test with dotnet
run: dotnet test ./eShopOnWeb.sln --configuration Release
- name: dotnet publish
run: dotnet publish ./src/Web/Web.csproj -c Release -o '${{env.DOTNET_ROOT}}/myapp'
# upload the published website code artifacts
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
# upload the bicep template as artifacts for next job
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: bicep-template
path: ${{ env.TEMPLATE-FILE }}
# Use Bicep to deploy infrastructure + Publish webapp
deploy:
runs-on: windows-latest
needs: buildandtest
environment:
name: 'Development'
steps:
#Download the publish files created in previous job
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: .net-app
path: .net-app
#Download the bicep templates from previous job
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: bicep-template
path: bicep-template
#Login in your azure subscription using a service principal (credentials stored as GitHub Secret in repo)
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
# Deploy Azure WebApp using Bicep file
- name: deploy
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ env.SUBSCRIPTION-ID }}
resourceGroupName: ${{ env.RESOURCE-GROUP }}
template: bicep-template/webapp.bicep
parameters: 'webAppName=${{ env.WEBAPP-NAME }} location=${{ env.LOCATION }}'
failOnStdErr: false
# Publish website to Azure App Service (WebApp)
- name: Publish Website to WebApp
uses: Azure/webapps-deploy@v2
with:
app-name: ${{ env.WEBAPP-NAME }}
package: .net-app