Skip to content

Commit

Permalink
Create dotnet-build-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-meyer authored May 19, 2023
1 parent a977da4 commit 601452c
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: BuildTest

on: [push, pull_request]

jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
defaults:
run:
working-directory: ./Source
steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Dotnet clean
run: dotnet clean

- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal


publish_nuget:
needs: [build_and_test]
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
runs-on: windows-latest
defaults:
run:
working-directory: ./Source

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Dotnet clean
run: dotnet clean

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release

- name: Pack nuget
run: |
$env:RELEASE_VERSION=($env:GITHUB_REF).split("tags/v")[-1]
echo $env:RELEASE_VERSION
echo $env:GITHUB_SHA
mkdir nupkg
dotnet pack -p:PackageVersion=$env:RELEASE_VERSION -o $PWD\nupkg -p:RepositoryCommit=$env:GITHUB_SHA --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Publish nuget
run: |
cd nupkg
dotnet nuget push "**/*.nupkg" --api-key ${{secrets.NUGET_DEPLOY_KEY}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate

0 comments on commit 601452c

Please sign in to comment.