Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish external packages

I want to publish nuget packages from FAKE. But I don't use NuGet to create those packages. I have OctoPack installed in some projects and I'm running build with /p:RunOctoPack=True. This dumps .nupkg files in bin directory. How do I then collect those packages and push them to NuGet server? I can't seem to make NuGetPublish and FileIncludes to work together.

edit: for now I've worked around it using ExecProcess

Target "Publish" (fun _ ->
    let result = ExecProcess (fun info ->  
                   info.FileName <- "MySolution/.nuget/NuGet.exe"
                   info.WorkingDirectory <- "MySolutionDirectory"
                   info.Arguments <- "push \"**/bin/**/*.nupkg\" -s http://my-nuget-server") TimeSpan.MaxValue

    if result <> 0 then failwithf "NuGet.exe push returned with a non-zero exit code"

)

like image 500
Kamil Bałdyga Avatar asked May 02 '14 13:05

Kamil Bałdyga


1 Answers

As Steffen mentioned, you can use NuGet Publish task, it is described in the API but there is no tutorial for this.

Your script code could look like this:

NuGetPublish (fun nugetParams -> 
    { nugetParams with
        AccessKey = "nuget_api_key"
        PublishUrl = "nuget_feed_url"
        Project = "project_name"
        Version = "project_version"
        WorkingDir = "nupkg_file_location"
    }
)

Where:

  • Project - the main part of you nupkg file name (i.e. My.Super.Project)
  • Version - the version part of your nupkg file name (i.e. 0.0.10)
  • WorkingDir - the location of your nukpg file

The full nupkg file name that this task will be looking for is:

WorkingDir\Project.Version.nupkg

like image 95
Alexey Zimarev Avatar answered Sep 30 '22 06:09

Alexey Zimarev