-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (51 loc) · 1.7 KB
/
build.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
60
61
62
63
64
65
66
name: Build
on:
push:
workflow_dispatch:
inputs:
publish_github:
type: boolean
required: false
description: Publish to GitHub Packages
default: false
publish_nuget:
type: boolean
required: false
description: Publish to nuget.org
default: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dotnet tools
run: dotnet tool restore
- name: Restore dependencies
run: dotnet restore
- name: Format Check
run: dotnet format --no-restore --verify-no-changes
- name: Build
run: dotnet build --no-restore -c Release
- name : Test
run: dotnet test --no-build -c Release -l "console;verbosity=detailed"
- name: Pack
run: dotnet pack --no-build -c Release -o artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: nupkg
path: artifacts/*.nupkg
- name: NuGet add souce
id: nuget_add_source
if: inputs.publish_github
run: dotnet nuget add source -u hikarin522 -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text -n "github" "https://nuget.pkg.github.com/hikarin522/index.json"
- name: Publish GitHub Packages
if: steps.nuget_add_source.conclusion == 'success'
run: dotnet nuget push "artifacts/*.nupkg" -k ${{ secrets.GITHUB_TOKEN }} -s "github" --skip-duplicate
- name: Publish NuGet
if: inputs.publish_nuget
run: dotnet nuget push "artifacts/*.nupkg" -k ${{ secrets.NUGET_OLG_API_KEY }} -s "nuget" --skip-duplicate