-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.24 KB
/
nuget-cd.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
name: NuGet Packages CD
on:
push:
branches: 'main'
tags: '**'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
Pack:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/701 https://github.com/actions/checkout/pull/579
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV
- run: dotnet pack -c Release -p:PackageOutputPath=../../nuget -p:Version=$VERSION
- uses: actions/upload-artifact@v3
with:
name: NuGet
path: ./nuget
Publish:
runs-on: ubuntu-latest
needs: Pack
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- uses: actions/download-artifact@v3
with:
name: NuGet
path: ./nuget
- run: |
dotnet nuget push ./nuget/**.nupkg --source nuget.org --api-key ${{ secrets.NUGET_API_KEY }}