-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (59 loc) · 1.98 KB
/
ci.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
name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
schedule:
- cron: '4 13 * * 2'
env:
CONFIGURATION: Release
DOTNET_VERSION: 8.0.x
jobs:
ci:
runs-on: ubuntu-latest
name: ${{ github.event_name != 'schedule' && 'CI' || 'CI (schedule)' }}
steps:
- uses: actions/checkout@v4
- name: CI version suffix
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo 'VERSION_SUFFIX=ci-${{ github.run_id }}' >> $GITHUB_ENV
- name: Release version suffix
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: echo 'VERSION_SUFFIX=' >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build
run: dotnet build -c ${{ env.CONFIGURATION }} --version-suffix '${{ env.VERSION_SUFFIX }}'
- name: Test
run: dotnet test -c ${{ env.CONFIGURATION }} --no-build --verbosity normal --logger 'GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true'
- name: Pack
run: dotnet pack -c ${{ env.CONFIGURATION }} --no-build --version-suffix '${{ env.VERSION_SUFFIX }}'
- name: Upload
if: ${{ github.event_name != 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: packages
path: |
**/*.nupkg
**/*.snupkg
publish:
needs: ci
if: ${{ github.repository == 'ssone95/ChromaDB.Client' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && github.event_name != 'schedule' }}
runs-on: ubuntu-latest
name: Publish
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download
uses: actions/download-artifact@v4
with:
name: packages
- name: Publish to NuGet.org
run: dotnet nuget push '**/*.nupkg' --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json