-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (58 loc) · 1.96 KB
/
release.yaml
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
name: Release
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
build:
name: Build, Analyze & Test
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: NuGet Cache
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os}}-nuget
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: 'GitVersion.yaml'
- name: Restore
run: dotnet restore --verbosity Quiet
- name: Build
run: |
dotnet build -c release --no-restore \
-p:Version=${{ steps.gitversion.outputs.assemblySemVer }} \
-p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} \
-p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}
- name: Test
run: dotnet test -c release --no-restore --no-build
- name: Pack
run: |
dotnet pack -c release --no-restore --no-build \
-p:PackageVersion=${{ steps.gitversion.outputs.fullSemVer }} \
-p:PackageOutputPath=${{ runner.temp }}/packages
- name: Push
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json --skip-duplicate
working-directory: ${{ runner.temp }}/packages