Skip to content

Publish to NuGet

Publish to NuGet #16

Workflow file for this run

# workflow for re-running publishing to NuGet in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/anthropics/anthropic-sdk-csharp/actions/workflows/publish-nuget.yml
name: Publish to NuGet
on:
workflow_dispatch:
jobs:
publish:
name: publish
runs-on: ubuntu-latest
environment: production-release
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: '8.0.x'
- name: Build and pack
run: dotnet pack
--configuration Release
--output "${{github.workspace}}/artifacts/packages"
- name: Publish package to nuget.org
run: dotnet nuget push
$(find ${{ github.workspace }}/artifacts/packages/*.nupkg ! -name "*.symbols.nupkg")
--source https://api.nuget.org/v3/index.json
--api-key $NUGET_API_KEY
--skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.ANTHROPIC_NUGET_API_KEY || secrets.NUGET_API_KEY }}