-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (85 loc) · 2.94 KB
/
Copy pathdotnet.yml
File metadata and controls
102 lines (85 loc) · 2.94 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: .NET
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ released ]
workflow_dispatch:
inputs:
nuget:
description: 'Publish to NuGet'
required: true
type: boolean
default: false
github_packages:
description: 'Publish to GitHub Packages'
required: true
type: boolean
default: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity minimal
- name: Pack (Prerelease)
id: pack-prerelease
if: >
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch')
run: dotnet pack --configuration Release --no-build --output nupkgs -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --version-suffix alpha.$GITHUB_RUN_NUMBER
- name: Pack (Release)
id: pack-release
if: github.event_name == 'release'
run: dotnet pack --configuration Release --no-build --output nupkgs -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Upload Artifacts
if: >
(steps.pack-release.outcome == 'success') ||
(steps.pack-prerelease.outcome == 'success')
uses: actions/upload-artifact@v2
with:
name: nupkgs
path: nupkgs
publish:
if: >
(github.event_name == 'push') ||
(github.event_name == 'release') ||
(github.event_name == 'workflow_dispatch')
name: Publish
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: nupkgs
path: nupkgs
- name: Push (GitHub Packages)
if: >
(github.event_name != 'workflow_dispatch') ||
(github.event.inputs.github_packages == 'true')
run: dotnet nuget push "nupkgs/*.nupkg" --source https://nuget.pkg.github.com/teraa/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- name: Push (NuGet.org)
if: >
(github.event_name == 'release') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.nuget == 'true')
run: dotnet nuget push "nupkgs/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true