Band alignment of semiconductors from density-functional theory and many-body perturbation theory