Monday, May 20, 2013

Sitecore Continuos Deployment: From Zero to Hero (Part 2: Deploy)

This is a second blog post in a Build-Deploy-Test series. Here you'll see how to deploy the package created at the previous step, with some hints specific to CI usage.

This blog post is a part of the series:

Deployment script is based on the sample from PowerCore. However, the following changes were added:

1. Use relative path as a deployment package location


2. Cleanup databases before deploying new website, otherwise - database files might be locked


Here's the complete script: 


What's interesting, you can now run both build and deployment scripts from your favorite CI server.
My preferred one is TeamCity. It is free for the small teams, and it has such a great amount of useful features. In the area of build artifacts storage and dependencies management TFS is nowhere near. 

I'll add two build configurations: "Build" and "Deploy". Each of them will have just one build step - run PowerShell script. "Deploy" will also depend on "Build" and use its last successful output.

Build:

Deploy:

And here is what we get at the end:


Yes, with TeamCity you can browse contents of zip files online - one of those small usability improvements.
Now how to make "Deploy" configuration use build output from "Build"?

Just add a dependency. Here's how simple it is to configure it:


That's basically all you need to get up and running with Continuous Deployment for Sitecore. All source code and scripts used in this blog post can be found here:

If you still have questions - just leave a comment, or contact me in Twitter / LinkedIn and even %my github username%@gmail.com.