Merge pull request #21 from Owen-Krueger/dependabot/github_actions/Nu… #83
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 | |
on: | |
push: | |
tags: | |
- v[0-9]+.* | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
env: | |
BUILD_CONFIG: 'Release' | |
SOLUTION: 'SqliteMemoryDatabaseProvider.sln' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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/setup-nuget@v2.0.0 | |
- name: Restore dependencies | |
run: nuget restore $SOLUTION | |
- name: Setup .NET 6.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.x | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore $SOLUTION | |
- name: Build | |
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --p:Version=$BUILD_VERSION --no-restore | |
- name: Test | |
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal | |
- name: Publish | |
if: startsWith(github.ref, 'refs/tags/') | |
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |