-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 1.74 KB
/
Copy pathmain.yml
File metadata and controls
65 lines (53 loc) · 1.74 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
name: Main workflow
concurrency:
group: ${{ github.ref }}-ci
cancel-in-progress: true
on:
pull_request:
push:
branches: [ master ]
release:
types: [ published ]
env:
DOTNET_NOLOGO: true
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
jobs:
build:
name: Build and test
if: github.event_name != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.x
9.x
10.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal
publish:
name: Publish NuGet
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -p:Version=$VERSION
- name: Push to GitHub and Nuget feeds
run: |
dotnet nuget push "src/**/bin/Release/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key $NUGET_KEY --skip-duplicate
dotnet nuget push "src/**/bin/Release/*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --skip-duplicate