LPS-52169 Optimize portal build scripts and remove repeated steps