How build and publish to octopus deploy in two separate steps


I am using Octopus Deploy with Bamboo. in Bamboo I am trying to perform CI on all the feature branches so that all check ins get built and tested on the build server.
I am following this guide to build the apps:

I use this command to as a build step to create the package:
msbuild MySolution.sln /t:Build /p:RunOctoPack=true

I am wondering if there is to configure octopus and bamboo to only build and publish to octopus with the mainline branch.
For the branches, only build and report the test results.

Any help would be appreciated.

Hi Ben,

Thanks for reaching out! Like the title of this thread says, the way to go here would be to separate the building and packaging process, from the pushing process.

Octopack will only push the package if you pass it the parameter /p:OctoPackPublishPackageToHttp. If you don’t do it, It’ll still pack the package (as long as you pass /p:RunOctoPack=true) but It’ll leave it on the file system.

Once it is on the file system, you can add another step in your bamboo build to push it using Nuget.exe push:

I’m not a bamboo guru, but I’m sure there should be a way to tell bamboo to run this dedicated push step only when you build the mainline branch, and not with the others.

Hope that helps!

Hi Dalmiro,

Thanks for the quick reply this was a great help. I used your advice and was able to get my build server working correctly.

I was wondering when you run octopack as part of the ms build property, a nupkg file is created in the folders “bin” and as well as obj/octopacked". Are both these files the same?

Hi Ben,

Yes both files are ideally the same. We use obj/octopacked as a working dir to build the package, and if the packaging succeeds then we copy it to bin.

I discussed this with one of my teammates and decided to create a github issue to add a few MSBuild parameters so users can decide if they want to delete those packages during the build:

For the time being, if you want to delete them you’ll have to script that in your process.

Best regards,