Xcode build canceled when adding new Run Script Phase

I’m adding a Run Script Phase to compile my Cordova project before running with Xcode. The script is:

cd my-ionic-project ionic cordova build ios

However, Xcode is canceling the build without telling me what the issue is. What am I doing wrong? I have the script second from the top (beneath Target Dependencies) in Build Phases.