Add or update the Azure App Service build and deployment workflow config #58
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
# 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: CI/CD Azure Web App - MwhSampleWeb | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- README.md | |
- .vscode/** | |
- .gitignore | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- README.md | |
- .vscode/** | |
- .gitignore | |
env: | |
AZURE_WEBAPP_NAME: MwhSampleWeb | |
AZURE_WEBAPP_PACKAGE_PATH: Mwh.Sample.Web/publish | |
CONFIGURATION: Release | |
DOTNET_CORE_VERSION: 8.* | |
WORKING_DIRECTORY: Mwh.Sample.Web | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.*' | |
include-prerelease: true | |
- name: Restore | |
run: dotnet restore "${{ env.WORKING_DIRECTORY }}" | |
- name: Build | |
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore | |
- name: Test | |
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build | |
- name: Publish | |
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}" | |
- name: Deploy to Azure WebApp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.MwhSampleWeb_FFFF }} | |
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
- name: Publish Artifacts | |
uses: actions/[email protected] | |
with: | |
name: webapp | |
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |