Not exactly sure what yoou are asking but building a mendix app can be done from studio pro or via the mxbuild.exe tool (see this old but still valid blog: https://www.mxblog.eu/p/post/2533274790397205)
With the buildtool you should be able to script something and run the tool in the background.
Hope this is what yoou are looking for.