Add build script to perform default builds

 * move part of the logic out of Jenkins
 * add preliminary error checks
 * chain metadata generation