Update dotnet.yml #11
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, Test and Deploy to Azure Web App | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '.github/workflows/dotnet.yml' | |
- 'GitHubTest.Web/' | |
- 'GitHubTest.Tests/' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup MSBuild path | |
uses: microsoft/[email protected] | |
- name: Setup NuGet | |
uses: NuGet/[email protected] | |
- name: Setup VSTest | |
uses: darenm/Setup-VSTest@v1 | |
- name: Navigate to Workspace | |
run: cd $GITHUB_WORKSPACE | |
- name: Restore Packages | |
run: nuget restore GitHubTest.sln | |
- name: Build Solution | |
run: | | |
msbuild.exe /p:platform="Any CPU" /p:configuration="Release" | |
- name: Publish to folder | |
if: always() | |
run: msbuild GitHubTest.Web\GitHubTest.Web.csproj /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\" | |
- name: Upload artifact for deployment job | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ASP-app | |
path: '/published/**' | |
deploy: | |
runs-on: windows-latest | |
needs: build | |
environment: | |
name: 'PROD' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v2 | |
with: | |
name: ASP-app | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'githubdemoweb' | |
slot-name: 'Production' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_19F8008E4D5445D98833CE414AEC97D0 }} | |
package: . |