-
Notifications
You must be signed in to change notification settings - Fork 39
53 lines (46 loc) · 1.54 KB
/
dotnet.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
name: 'Server (C#)'
on:
push:
paths-ignore:
- '.github/workflows/web-assets.yml'
- 'WebAssets/**'
- '*.Demo*/**/*.cs'
- '*.Demo*/**/*.css'
- '*.Demo*/**/*.html'
- '*.Demo*/**/package.json'
pull_request:
workflow_dispatch:
jobs:
build-and-publish:
name: 'Build and Publish'
runs-on: windows-latest
env:
NUGET_PACKAGES: ${{github.workspace}}/.nuget/packages
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
# https://github.com/actions/setup-dotnet/issues/155#issuecomment-748452076
- run: dotnet nuget locals all --clear
- uses: actions/cache@v3
with:
path: ${{github.workspace}}/.nuget/packages
key: ${{runner.os}}-nuget-${{hashFiles('**/packages.lock.json')}}
restore-keys: |
${{runner.os}}-nuget-
- run: dotnet build --configuration Release
- run: dotnet test --no-build --configuration Release
- run: dotnet pack --no-build --output . --configuration Release
- if: github.ref == 'refs/heads/main'
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate
- if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v2-preview
with:
path: '*.nupkg'