Add prerelease support to build script

[ci skip]