One of the things I try to do as part of a build pipeline is to have automatic package updates. My usual pattern is something along the lines of a CI build that runs on every commit and every night, plus a Canary build that updates all the packages to their latest respective versions.
The sequence looks something like this:
- The Canary build:
- pulls the lastest of the project from the
master
branch; - runs
nuget.exe update
or equivalent; - then compiles the code and runs the unit tests.
- pulls the lastest of the project from the
-
If everything passes, it does (roughly) this:
git checkout -b update-packages git add -A . git commit -m "Automatic package update" git push -f origin update-packages # Note: There's a bit more error-checking around non-merged branches and so on, # but that's fundamentally it.
- The CI build then:
- picks up the changes in the
update-packages
branch; - compiles the code (yes, again), to make sure that we didn’t miss anything in the previous commit);
- runs the unit tests;
- deploys the package to a CI environment;
- runs the integration tests; and
- if all is well, merges the
update-packages
branch back down tomaster
.
- picks up the changes in the
For what it’s worth, if a master
build is green (and they pretty much all should go green if you’re building your pull requests) then out the door it goes. You do trust your test suite, don’t you? ;)
All of this can be done with stock TeamCity build steps with the exception of one thing: the call to nuget.exe update
doesn’t add binding redirects and there’s no way to do that from the console. The Add-BindingRedirect
PowerShell command is built into the NuGet extension to Visual Studio and there’s no way to run it from the command line.
That’s always been a bit of a nuisance and I’ve hand-rolled hacky solutions to this several times in the past so I’ve re-written a slightly nicer solution and open-sourced it. You can find the Add-BindingRedirect project on GitHub. Releases are downloadable from the Add-BindingRedirect releases page.
Pull requests are welcome :)