Using NetBeans 8, how can I create a script to do each of these things?
For such a scenario you should look into Phing (or even Apache Ant).
The Joomla Documentation provides some basic steps to do this in Eclipse. I am sure it can be valuable to achieve something similar in Netbeans as well.
Extension development using eclipse and phing
Hope this helps a bit to get you in the right direction.