finalise the build script for automated builds and archiving in jenkins