Make build_doc run only for the first job and redirect stdout and stderr to void when git push fails.

@asmeurer
Fixed in #7795.