I have a nuget package that runs Travis CI for its builds. Here is my yml:
language: csharp
solution: TreasureGen.sln
install:
- nuget restore TreasureGen.sln
My .travis.yml is as below, it deploys correctly to nuget and only does the deploy from master branch. The NUGET_API environment variable is setup to only apply to master branch and not be visible in the build.
language: csharp
mono: none
dotnet: 3.1
before_install:
- sudo apt-get -y install libpam0g-dev
install:
- dotnet restore
script:
- dotnet build -c Release
after_success:
- ./test/setup_test_account.sh
- sudo dotnet test test/Npam.Tests/Npam.Tests.csproj
before_deploy:
- dotnet pack -c Release
deploy:
skip_cleanup: true
provider: script
script: dotnet nuget push ./src/Npam/bin/Release/Npam.*.nupkg -k $NUGET_API -s https://api.nuget.org/v3/index.json
on:
branch: master
https://github.com/CamW/npam/blob/master/.travis.yml