Crappystrano
Note: After I started this series Jeremy Miller has posted a very relevant article about source code hygiene issues.
(This is the third part in a series - you should probably read part one and two first.)
Today I’ll present a sanitised copy of my deployment script. I’ve based the design of deploy.cmd on Capistrano1 . The script is nicknamed “Crappystrano”. Here’s the output (pretty htmlized source is here):
>deploy.cmd
Crappystrano - the shit script which (sort of) deploys stuff
deploy.cmd staging|live [branchpath]
Here’s breakdown of the steps2 - skipping some error checking3. :
- Do we have the required dependencies4 on the path? If we don’t copy them to the path if they’re just 1 exe - otherwise exit with an error.
- Check the command line parameters. We must have the environment we’re releasing to? Are we releasing from the trunk or from a SVN branch?
- Construct a release time stamp. This is YYYYMMDDHHMMSSMS.
- Perform a “svn export” from the trunk/branch to %tmp%\staging|live%timestamp%. [E]
- Use msbuild to build the solution. [E]
- Rearrange the folder structure so we only get the artefacts we need in the release package.
- Zip up the release package using the environment name + time stamp.
- move the release package back to the root directory of the project and delete the export from %tmp%.
- Make a SVN tag (svn copy trunk/branch /tags/environment-timestamp).
I’ve uploaded a zip file with the script and folder structure + a little readme. This is not the best way of doing things - it’s just a very lightweight way. Comments, questions, feedback etc… are gratefully received.
- http://www.capify.org/ - I know some people are going to say - just use Capistrano. There are two reasons for me not to: 1. I’m the only person in my team familiar with Ruby. 2. Even if you argue that they don’t need to understand ruby to run a cap deployment recipe - they still have to have it installed. It’s just yet another dependency which I’m not willing to take currently. [↩]
- This is all simplified as the actual script supports a SaaS product which has multiple instances - one per client [↩]
- noted with [E] [↩]
- gnu zip.exe, svn [↩]