.NET CI #31
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 CI | |
on: | |
create: | |
branches: | |
- release/** | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
env: | |
BUILD_CONFIG: 'Release' | |
SOLUTION: 'Autometrics-CS.sln' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Build Version | |
run: | | |
Import-Module .\build\GetBuildVersion.psm1 | |
Write-Host $Env:GITHUB_REF | |
$version = GetBuildVersion -VersionString $Env:GITHUB_REF | |
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
shell: pwsh | |
- name: Setup NuGet | |
uses: NuGet/[email protected] | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore $SOLUTION | |
- name: Build | |
run: dotnet build $SOLUTION --no-restore --configuration $BUILD_CONFIG | |
- name: Run Tests | |
run: dotnet test $SOLUTION --no-restore --no-build --verbosity normal --configuration $BUILD_CONFIG --logger "nunit" | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
src/Autometrics.Instrumentation.Tests/TestResults/TestResults.xml | |
- name: Publish | |
if: startsWith(github.ref, 'refs/heads/release') | |
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.AUTOMETRICS_NUGET_PACKAGE_KEY}} |