-
-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (33 loc) · 1.05 KB
/
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
name: Build, Test and Release to NuGet
on:
push:
branches:
- main
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.2.0
- name: Restore dependencies
run: nuget restore
- name: Set VERSION variable from tag
run: |
TAG=${{github.event.release.tag_name}}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Build
run: dotnet build -c Release${{github.event.release.tag_name && ' -p:Version='}}${{github.event.release.tag_name && env.VERSION}}
- name: Test
run: dotnet test -c Release --no-build
- name: Pack nugets
run: dotnet pack -c Release --no-build --output .
- name: Push to NuGet
if: github.event_name == 'release'
run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json