Run build and test with .NET 9 SDK only #4
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 and test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup dotnet 9.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "9.0.x" | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1.1.1 | |
with: | |
versionSpec: "5.x" | |
preferLatestVersion: true | |
- name: Determine Version | |
id: version # step id used as reference for output values | |
uses: gittools/actions/gitversion/execute@v1.1.1 | |
with: | |
useConfigFile: true | |
- name: Build | |
run: dotnet build --configuration Release | |
- name: Test | |
run: dotnet test --configuration Release --logger trx --results-directory "TestResults-9.0.x" | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dotnet-results-9.0.x | |
path: TestResults-9.0.x | |
if: ${{ always() }} | |
- name: Package | |
run: dotnet pack --output pkg | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BobTheBuilder.${{ steps.version.outputs.majorMinorPatch }}.nupkg | |
path: pkg/BobTheBuilder.${{ steps.version.outputs.majorMinorPatch }}.nupkg |