我有一个运行Travis CI的nuget软件包.这是我的yml:
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 - nuget install NUnit.Runners -OutputDirectory testrunner script: - xbuild TreasureGen.sln /p:TargetFrameworkVersion="v4.5" /p:Configuration=Stress - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Unit/bin/Stress/TreasureGen.Tests.Unit.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.IoC/bin/Stress/TreasureGen.Tests.Integration.IoC.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Tables/bin/Stress/TreasureGen.Tests.Integration.Tables.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Stress/bin/Stress/TreasureGen.Tests.Integration.Stress.dll理想情况下,当它在master分支上运行时,如果成功,则将根据需要部署nuget软件包.解决方案中已经有Nuget项目,每个项目包含 Package.nuspec 和 NuGet.config 文件.我曾尝试让它自己部署,但并没有取得太大的成功-通常我会遇到身份验证方面的问题,但不是排他性的.我想知道这里是否有人在Travis中部署了像这样的nuget包,以及他们是如何做到的.
Ideally, when this runs on the master branch, if it is successful, it would then deploy the nuget packages as needed. There are already Nuget projects in the solution, which contain Package.nuspec and NuGet.config files for each package. I have tried getting it to deploy myself and have not had much success - typically I run into problems with the authentication, but not exclusively. I was wondering if anyone here has deployed nuget packages like this in Travis and how they did it.
推荐答案经过反复的摸索和试验,我终于找到了解决方法.
After much fiddling and experimentation, I finally found a solution.
.travis.yml
language: csharp solution: TreasureGen.sln install: - nuget restore TreasureGen.sln - nuget install NUnit.Runners -OutputDirectory testrunner script: - xbuild TreasureGen.sln /p:TargetFrameworkVersion="v4.5" /p:Configuration=Stress - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Unit/bin/Stress/TreasureGen.Tests.Unit.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.IoC/bin/Stress/TreasureGen.Tests.Integration.IoC.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Tables/bin/Stress/TreasureGen.Tests.Integration.Tables.dll - mono ./testrunner/NUnit.ConsoleRunner.*/tools/nunit3-console.exe ./TreasureGen.Tests.Integration.Stress/bin/Stress/TreasureGen.Tests.Integration.Stress.dll deploy: skip_cleanup: true provider: script script: chmod +x ./deploy/deploy.sh && ./deploy/deploy.sh $NUGET_API_KEY $NUGET_SOURCE on: branch: masterdeploy.sh
ApiKey=$1 Source=$2 nuget pack ./TreasureGen/TreasureGen.nuspec -Verbosity detailed nuget pack ./TreasureGen.Domain/TreasureGen.Domain.nuspec -Verbosity detailed nuget push ./DnDGen.TreasureGen.*.nupkg -Verbosity detailed -ApiKey $ApiKey -Source $Source nuget push ./DnDGen.TreasureGen.Domain.*.nupkg -Verbosity detailed -ApiKey $ApiKey -Source $Source以下是要记住的一些关键事项:
Here are some of the key things to remember:
更多推荐
如何在Travis CI中部署nuget软件包?
发布评论