-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (48 loc) · 1.47 KB
/
build.yml
File metadata and controls
53 lines (48 loc) · 1.47 KB
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
name: Build
on:
pull_request:
push:
tags:
- '**'
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'Matterhook.NET.MatterhookClient.sln'
runs-on: ubuntu-latest
steps:
-
name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0 # To make GitVersion work (installed as dependency in project)
-
name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
-
name: Restore dependencies
run: nuget restore $SOLUTION
-
name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
-
name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore
-
name: Run Tests
run: dotnet test --no-restore --verbosity normal
-
name: Publish
if: github.event_name != 'pull_request'
run: |
if [ "${{ secrets.NUGET_API_KEY }}" != "" ]; then
echo "Pushing to nuget.org"
nuget push Matterhook.NET.MatterhookClient/bin/Release/*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
else
echo "Not pushing to nuget.org, no NUGET_API_KEY set in repo secrets"
fi
echo "Pushing to github packages"
nuget push Matterhook.NET.MatterhookClient/bin/Release/*.nupkg -Source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json' -ApiKey ${{secrets.GITHUB_TOKEN}}