Skip to content

Commit fa58740

Browse files
authored
Merge pull request #32 from Bardin08/vbardin/setup-github-actions
Add NuGet Publish workflow
2 parents 1ef2c9b + 62e31aa commit fa58740

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/nuget-publish.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build and Publish NuGet
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: '8.0.x'
18+
19+
- name: Extract release version
20+
id: release_version
21+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
22+
23+
- name: Restore dependencies
24+
run: dotnet restore
25+
26+
- name: Build
27+
run: dotnet build --configuration Release --no-restore
28+
29+
- name: Test
30+
run: dotnet test --no-restore --verbosity normal
31+
32+
- name: Pack
33+
run: dotnet pack --configuration Release --no-build --output nupkgs /p:PackageVersion=${{ env.RELEASE_VERSION }}
34+
35+
- name: Push to NuGet
36+
run: dotnet nuget push "nupkgs/**/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)