-
Notifications
You must be signed in to change notification settings - Fork 34
57 lines (54 loc) · 1.9 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
# 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: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.419
8.0.201
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore /p:BuildNumber=${{ github.run_number }}
- name: Ensure Playwright browsers are installed
run: pwsh test/SmartComponents.E2ETest.Blazor/bin/Debug/net8.0/playwright.ps1 install chromium --with-deps
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Pack
run: dotnet pack -c Release /p:BuildNumber=${{ github.run_number }}
- name: Benchmark
run: cd benchmark/SmartComponents.LocalEmbeddings.Benchmark && dotnet run -c Release -- --filter "*"
- name: Upload artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: nuget-packages
path: artifacts/*.nupkg
if-no-files-found: error
- name: Check if publishing
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest'
id: check-if-publishing
shell: bash
run: |
if [ "${{ secrets.NUGET_API_KEY }}" != '' ]; then
echo "should_publish_to_nuget=true" >> $GITHUB_OUTPUT;
fi
- name: Publish to NuGet.org
if: ${{ steps.check-if-publishing.outputs.should_publish_to_nuget == 'true' }}
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}