Publish pushes to a public nuget feed

Hi,

there is a public nuget server which is the production environment for a project. How do i get octopus deploy to push a package from its own nuget feed to an external nuget feed when publishing to production environment?

I tried via PowerShell script, but i don’t know how i can grab the projects nuget package.

Can you help me?
Best regards.

Hi,

Thanks for reaching out. You can use the variable $OctopusParameters['Octopus.Tentacle.CurrentDeployment.PackageFilePath'] to get the full path of the package that Octopus is using during the deployment. With that path in hand, you can use Nuget.exe from a Powershell script to push it to your destination feed.

That variable will return a value similar to this: C:\Octopus\Files\TestConfig.1.0.8.nupkg-83393274-b0e9-4290-961c-f4cef73f9153 . Make sure to remove the gibberish after .nupkg from the file’s name before pushing it to your feed.

Gotcha: That variable is only available within the deployment step. This means that to be able to use it from a Powershell script, you need to run it using the Scripts in package steps feature

Hope that helps,

Dalmiro

Hi,
Thank you very much. It works as well.
If there’s chance to install a tentacle on this server, is it even possible to deploy a nuget package as a package without extracting it?

Thanks in advance!

Hi,

I’m afraid that the package extraction is not something that can be stopped. You could add a Powershell script step that deletes the extracted content. Not the cleanest approach, but it’ll definitely work.

Thanks!

Dalmiro