-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (45 loc) · 1.46 KB
/
publish.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
55
56
57
58
59
name: Publish
on:
push:
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
jobs:
# Build, test and publish (if this is a push/merge).
publish-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test test/Soenneker.Swashbuckle.SmartEnumFilter.Tests.csproj --no-restore --verbosity normal
publish-package:
needs: publish-build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setting up build version
run: |
version=$(($GITHUB_RUN_NUMBER))
echo "BUILD_VERSION=1.0.$version" >> ${GITHUB_ENV}
- name: Setup .NET Core 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --no-build --configuration Release --output .
- name: Publish to nuGet
run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate