-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (52 loc) · 1.54 KB
/
build-release.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
name: NuGet Release
on:
push:
tags: v*
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '8.0.x' ]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Build Version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:11})" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release -p:Version=$RELEASE_VERSION
- name: Test
run: dotnet test --no-build --configuration Release --logger trx
- name: Pack
run: dotnet pack --no-build --output ./artifacts --configuration Release -p:Version=$RELEASE_VERSION
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: ./artifacts
publish-nuget:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [ build ]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_APIKEY }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
source-url: https://api.nuget.org/v3/index.json
- uses: actions/download-artifact@v1
with:
name: artifacts
path: ./artifacts
- name: Upload to NuGet
run: dotnet nuget push ./artifacts/**/*.nupkg --skip-duplicate -n -k $NUGET_AUTH_TOKEN