Skip to content

Instantly share code, notes, and snippets.

@CalvinAllen
Last active April 1, 2024 11:40
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save CalvinAllen/701695399e5966845a206954820c329e to your computer and use it in GitHub Desktop.
Save CalvinAllen/701695399e5966845a206954820c329e to your computer and use it in GitHub Desktop.
A GitHub Action to build a .NET Framework Web Application and Deploy it to Azure
name: EZRep Build
on:
push:
branches: master
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
- name: Navigate to Workspace
run: cd $GITHUB_WORKSPACE
- name: Create Build Directory
run: mkdir _build
- name: Restore Packages
run: nuget restore EzRep.sln
- name: Build Solution
run: |
msbuild.exe EzRep.sln /nologo /nr:false /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:platform="Any CPU" /p:configuration="Release" /p:PublishUrl="../_build"
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: EZRepBundle
path: "./_build"
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Publish Artifacts to Azure
uses: Azure/webapps-deploy@v2
with:
app-name: ezrep
package: "./_build"
slot-name: production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment