Improved CI script for building packages