Last active
December 9, 2021 17:24
-
-
Save Aldaviva/4e582c7888ee10703df362eec9055838 to your computer and use it in GitHub Desktop.
GitHub Actions CI workflow files for .NET Framework, .NET Core, and .NET projects. Save one of these in ./.github/workflows.
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: .NET Core | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
env: | |
ProjectName: MyProjectNameHere | |
runs-on: windows-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up .NET SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Publish | |
run: dotnet publish --configuration Release -p:PublishSingleFile=true --runtime win10-x64 --self-contained false | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.ProjectName }}.exe | |
path: ${{ env.ProjectName }}\bin\Release\**\publish\*.exe |
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: .NET Framework | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
env: | |
ProjectName: MyProjectNameHere | |
runs-on: windows-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up MSBuild | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Restore and build | |
run: msbuild $env:ProjectName /p:Configuration=Release -t:build -restore | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.ProjectName }}.exe | |
path: ${{ env.ProjectName }}\bin\Release\*.exe | |
if-no-files-found: error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment