Skip to content

Instantly share code, notes, and snippets.

@Aldaviva
Last active December 9, 2021 17:24
Show Gist options
  • Save Aldaviva/4e582c7888ee10703df362eec9055838 to your computer and use it in GitHub Desktop.
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.
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
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