Skip to content

chore: Update CI workflow to publish NuGet packages and configure Min… #17

chore: Update CI workflow to publish NuGet packages and configure Min…

chore: Update CI workflow to publish NuGet packages and configure Min… #17

Workflow file for this run

# .github/workflows/ci.yml
name: Publish NuGet
on:
push:
tags: [ 'v*.*.*' ] # push when you create v1.2.3 tag
branches: [ main ] # or build every commit
workflow_dispatch: # manual button
jobs:
build-pack-push:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # REQUIRED for MinVer
- name: Setup .NET (latest stable)
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x # change to 9.0.x when GA
cache: true # NuGet caching
- name: Restore, build, test
run: |
dotnet restore
dotnet build --configuration Release
dotnet test --configuration Release
- name: Pack (incl. symbols)
run: dotnet pack --configuration Release --include-symbols
# ---------- publish to nuget.org ----------
- name: Push to nuget.org
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push "**/*.nupkg" \
--api-key "${{ secrets.NUGET_API_KEY_ZASTRING }}" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate