Skip to content

Up version

Up version #3

Workflow file for this run

name: Publish NuGet Package
on:
push:
tags:
- 'v*' # Triggers on push of a tag that starts with "v" (e.g., v1.0.0)
jobs:
build-test-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x' # Specify the required .NET SDK version
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --configuration Release --no-restore
# Note:
# Tests for .NET Core 3.1, .NET 5.0, and .NET 6.0 are not run in this CI workflow,
# because the GitHub Actions environment is configured with .NET 7.0 runtime only.
# To run tests for .NET Core 3.1, .NET 5.0, or .NET 6.0, execute the tests locally
# on a machine where the corresponding runtime versions are installed.
- name: Run tests (net7.0 only)
run: dotnet test SolveCaptcha.Tests/SolveCaptcha.Tests.csproj --framework net7.0 --configuration Release --no-build
- name: Pack project
run: dotnet pack --configuration Release --no-build --output nupkg
- name: Publish package to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push nupkg/solvecaptcha-csharp.*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json