A higher Chern-Weil derivation of AKSZ sigma-models