-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (75 loc) · 2.5 KB
/
build-test-publish.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Build, Test, Publish
on:
- push
jobs:
build:
name: Build and Test
runs-on: macos-latest
env:
DOTNET_NOLOGO: true
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
defaults:
run:
working-directory: src
outputs:
is-release: ${{ steps.get-version.outputs.is-release }}
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set version
uses: triaxis-oss/dotnet-set-version@v1
id: get-version
with:
project: src/triaxis.BluetoothLE/triaxis.BluetoothLE.props
- name: Install workloads
run: |
dotnet workload restore triaxis.BluetoothLE.Maui/triaxis.BluetoothLE.Maui.csproj
- name: Build
run: |
dotnet build build.proj
- name: Upload Package Artifacts
uses: actions/upload-artifact@v2
with:
name: packages
path: src/packages/**/*nupkg
- name: Test
run: dotnet test triaxis.BluetoothLE.Tests -c Release -v Normal -l "junit;logFilePath=test-results.xml"
- name: Upload Test Artifacts
uses: actions/upload-artifact@v2
with:
name: test-results
path: src/**/test-results.xml
publish-test-results:
name: Publish test results
runs-on: macos-latest
needs: build
steps:
- name: Fetch Test Artifacts
uses: actions/download-artifact@v4
with:
name: test-results
path: ${{runner.temp}}/res
- name: Publish Test Results
uses: enricomi/publish-unit-test-result-action/composite@v1
if: always()
with:
files: ${{runner.temp}}/res/**/test-results.xml
publish-nuget:
name: Publish NuGet
runs-on: macos-latest
env:
DOTNET_NOLOGO: true
needs: build
steps:
- name: Fetch Package Artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: ${{runner.temp}}/packages
- name: Publish NuGet Packages
if: needs.build.outputs.is-release == 'true'
run: dotnet nuget push ${{runner.temp}}/packages/*.nupkg -s nuget.org -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
- name: Publish GitHub Packages
if: needs.build.outputs.is-release != 'true'
run: dotnet nuget push ${{runner.temp}}/packages/single/*.nupkg -s https://${{github.actor}}@nuget.pkg.github.com/${{github.repository_owner}} -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate