-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (44 loc) · 1.47 KB
/
main.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
name: CI
on:
create:
branches:
- release/**
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
env:
BUILD_CONFIG: "Release"
runs-on: ubuntu-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 NuGet
uses: NuGet/[email protected]
with:
nuget-version: latest
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: nuget restore ./src/TinyPubSub.sln
- name: Restore dependencies
run: dotnet restore ./src/TinyPubSub/TinyPubSub.csproj
- name: Build
run: dotnet build ./src/TinyPubSub --no-restore --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
- name: Run tests
run: dotnet test ./src/TinyPubSub.Tests /p:Configuration=$BUILD_CONFIG /p:Version=$BUILD_VERSION --verbosity normal
- name: Publish
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push ./src/TinyPubSub/**/*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}