Merge pull request #346 from MADE-Apps/dotnet-upgrade #410
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: CI | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
paths: | |
- src/** | |
- samples/** | |
- tests/** | |
- build/** | |
- .github/workflows/ci.yml | |
- global.json | |
pull_request: | |
branches: | |
- main | |
paths: | |
- src/** | |
- samples/** | |
- tests/** | |
- build/** | |
- .github/workflows/ci.yml | |
- global.json | |
workflow_dispatch: | |
jobs: | |
build: | |
env: | |
BUILD_CONFIG: 'Release' | |
SOLUTION: 'MADE.NET.sln' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- 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 .NET 6.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
- name: Setup .NET 8.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore $SOLUTION | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Build | |
run: msbuild $env:SOLUTION /p:Configuration=$env:BUILD_CONFIG /p:Platform="Any CPU" -p:Version=$env:BUILD_VERSION | |
- name: Run tests | |
run: dotnet test /p:Configuration=$env:BUILD_CONFIG /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --no-restore --no-build --verbosity normal | |
- name: Publish | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |