There are 2 challenges to publish nuget: extract version to provide correct nuget file name and API key. While API key could be passed with the drone.io secret the getting version requires some trick with shell commands:
1 2 3 4 5 6 7 8 9 10 11 |
build-test-publish-debug: when: branch: [nuget-debug] image: microsoft/dotnet:2.0-sdk secrets: [nuget_key] commands: - dotnet build Map2Core -c Debug -v minimal - dotnet pack Map2Core -c Debug - dotnet test TestMap2Core -c Debug - ver=`grep Version Map2Core/Map2Core.csproj |sed 's/.*<Version>//'|sed 's/<.*//'` - dotnet nuget push Map2Core/bin/Debug/S4y.Map2.Core.`echo $ver`.nupkg -k $${NUGET_KEY} -s https://api.nuget.org/v3/index.json |