-
-
Notifications
You must be signed in to change notification settings - Fork 20
72 lines (59 loc) · 1.66 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.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}}