You may find you need to use different build commands for different environments, in this case, you can usually use something similar to the following:
gulp build --%environment%
Which would result in
gulp build --production or
gulp build --staging etc. as necessary. You can set your environment on a per server basis.
However, if you need to be a bit more specific, or maybe have a more complex set of build commands per server, you could use a conditional build command as follows:
if [ "%environment%" == "production" ]; then // Production commands else // Other commands fi