Skip to content

Commit 97ef09f

Browse files
Add publish_nuget.yml
1 parent 3c48b04 commit 97ef09f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workfows/publish_nuget.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on push of a tag that starts with "v" (e.g., v1.0.0)
7+
8+
jobs:
9+
build-test-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET SDK
17+
uses: actions/setup-dotnet@v2
18+
with:
19+
dotnet-version: '7.0.x' # Specify the required .NET SDK version (e.g., 6.0.x or another version)
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build project
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Run tests
28+
run: dotnet test SolveCaptcha.Tests/SolveCaptcha.Tests.csproj --configuration Release --no-build
29+
30+
- name: Pack project
31+
run: dotnet pack --configuration Release --no-build --output nupkg
32+
33+
- name: Publish package to NuGet
34+
env:
35+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
36+
run: dotnet nuget push nupkg/solvecaptcha-csharp.*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)