-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (45 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
54
55
56
57
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.x.x
- name: Restore dependencies
run: dotnet restore
- name: Build (Release)
run: dotnet build --configuration Release --no-restore
- name: Test (Release)
run: dotnet test --configuration Release --no-build --no-restore
- name: Upload Artifacts
uses: actions/upload-artifact@v4.3.6
if: failure()
with:
name: test-artifact
path: |
./test/BenchmarkDotNetVisualizer.Tests/_reports
./test/BenchmarkDotNetVisualizer.Tests/_snapshots
retention-days: 5
- name: Pack (Release)
run: dotnet pack --configuration Release --output ./nuget --no-build --no-restore
- name: Publish
if: github.event_name == 'workflow_dispatch' # manually run
run: |
if [[ ${{github.ref}} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
dotnet nuget push ./nuget/*.nupkg -s nuget.org -k ${{secrets.NUGET_TOKEN}} --skip-duplicate
else
echo "publish is only enabled by tagging with a release tag"
fi