If you are using Bamboo, I would use Dan's answer above and modify it to support your Salesforce workflow.
What I've done is to use the Atalassian's Salesforce build plans and modified it to inject a node.js task between the "Checkout Source Code" task and the ant "deployEmptyCheckOnly" task in the "Dev All Tests" plan. When setting it up use "index.js" as the Script and "master yourFeature ./deploy/" as the Arguments. Do not specify a working sub-directory and Dan's script should work just fine.
You may also want to modify the lib/metaUtils.js file from Dan's source code listed in his response above to include all of the metadata types and folder names that you plan to track via automated deployment.
You can also use my forked version at https://github.com/jasonerivera/sf-packager which already has this file updated with all of the currently known metadata types. Use at your own risk.
You'll want to take the source files and folders from sf-packager and put them in the root directory of your repository and check them in. You'll also want to update the build/build.xml file to point to the /deploy folder everywhere you see "deployRoot" as this is where the sf-packager script will build your final deployment package. Do not use /src as the deployRoot or else you will be deploying everything that you checked out of the repo which is what the Atlassian documentation has you doing by default.
deployRoot="${basedir}/deploy/*${sfdc.featureName}*/unpackaged"
This implies that ${sfdc.featureName} is a variable that will be the same as the yourFeature parameter you used in the arguments section of the node.js task you set up as that is the directory sf-packager will automatically create for you. It would be wise to keep this dynamic by using Bamboo repository variables to replace the value in your build.xml file (${bamboo.sfdc.feature.name}), especially if you will be using Plan Branching. You would in this case need to add "-Dsfdc.featureName=${bamboo.sfdc.feature.name}" to the end of the Environment variables section of the deployment ant task in the Bamboo plan you build.
Another feature you may want to turn on is Plan Branching. This will allow you to build a deployment package with only changes between your feature branch against the Dev/master branch. As long as the Salesforce org you are going to "deployEmptyCheckOnly" to (from the feature branch) is not the shared Dev org, then you can have multiple developers pulling from Dev/master automatically down into their feature/master by using automatic branch management (Branch updater), but running unit tests to a separate unadulterated staging box that looks like Dev (or production) without everyone waiting in line to run unit tests against Dev. This concept has proven to eliminate one of the most painful bottlenecks with regard to Salesforce CI in our org.
There are too many other details to post here on how to set it all up, but the key concepts I've listed above. If you follow the Atlassian Salesforce model to the "t" first, then it is easy to inject this script in a task to make building deployment packages automated. The only other thing to watch out for is to make sure you know the 'git diff' command and how it actually works from the Bamboo server once this task is running. I spent a lot of time wondering why I didn't see any changes between master and feature.
package.xml
on the fly. Looks likegit show <SHA>
command only shows files that are changed in that commit but I think we need a way to know what all files changes from the given commit to the HEAD. Not sure if my question is clear but your idea sounds interesting and looks like a possible solution.git dif
? Because this command shows list of files that were changed between two commits. stackoverflow.com/questions/1552340/… Looks like I have everything needed in place and I will start making it work tonight. Thanks for your help also please post if you have any scripts that would be very helpful. once again thanks for your time!