How do I deploy nuget packages in Travis CI?

前端 未结 4 488
一个人的身影
一个人的身影 2021-02-08 03:14

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         


        
4条回答
  •  遇见更好的自我
    2021-02-08 03:40

    Accepted answer didn't work for me (I don't know why). Following is what worked.

    language: csharp
    solution: [SolutionName].sln
    install:
      - curl -L -o nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
      - mono nuget.exe restore [SolutionName].sln
    script:
      - xbuild /p:Configuration=Release [SolutionName].sln
      - mono nuget.exe pack ./[NuspecName].nuspec
      - mono nuget.exe setApiKey $NUGET_API_KEY -Source $NUGET_SOURCE -Verbosity quiet
      - mono nuget.exe push [SolutionName].*.nupkg -Source $NUGET_SOURCE
    

    $NUGET_SOURCE, $NUGET_API_KEY are environment variables defined in Travis.

提交回复
热议问题