optimized nightly-build.sh

we chack that a commit was made by the last one
clean older builds and logs