-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (61 loc) · 2.23 KB
/
publish.yaml
File metadata and controls
72 lines (61 loc) · 2.23 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Publish
on:
workflow_dispatch:
inputs:
prerelease:
default: true
description: Set as pre-release
type: boolean
required: true
push:
default: false
type: boolean
description: Push to nuget.org
push:
branches: ["master"]
jobs:
publish:
runs-on: ubuntu-latest
env:
PackageOutputDir: ".packages"
Prerelease: ${{ github.event.inputs.prerelease || 'false' }}
PushPackage: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event.inputs.push }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "6.0.5"
- name: Determine Version
run: |
${GITVERSION_PATH}/dotnet-gitversion /output buildserver /output json
- name: Pack
run: |
dotnet pack --nologo -o ${PackageOutputDir} \
-p:PackageVersion=${GitVersion_SemVer} \
-p:AssemblyVersion=${GitVersion_AssemblySemFileVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:AssemblyVersion=${GitVersion_AssemblySemVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:Configuration=Release
- name: Nuget Push
if: env.PushPackage == 'true'
working-directory: ${{ env.PackageOutputDir }}
run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: v${{ env.GitVersion_SemVer }}
tag: v${{ env.GitVersion_SemVer }}
artifacts: ${{ env.PackageOutputDir }}/*.nupkg
generateReleaseNotes: true
commit: ${{ env.GitVersion_Sha}}
prerelease: ${{ env.Prerelease }}