-
Notifications
You must be signed in to change notification settings - Fork 85
60 lines (45 loc) · 1.79 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
name: .NET Build, Test, and Publish Nuget Package
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch all history for all tags and branches
run: |
git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch --prune --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore OllamaSharp.sln
- name: Build
run: dotnet build --no-restore --configuration=Release /p:Version=${{steps.gitversion.outputs.semVer}}
- name: Test
run: dotnet test --no-build --configuration=Release --verbosity normal
- name: pack nuget packages
run: dotnet pack --output nupkgs --configuration=Release --no-restore --no-build /p:PackageVersion=${{steps.gitversion.outputs.semVer}}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{steps.gitversion.outputs.semVer}}
name: Release ${{steps.gitversion.outputs.semVer}}
if: github.event_name != 'pull_request'
- name: upload nuget package
if: github.event_name != 'pull_request'
run: dotnet nuget push nupkgs/OllamaSharp*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json