Ionic Appflow - package.json and shell scripts


#1

In the Build Environments docs for Appflow (https://ionicframework.com/docs/appflow/environments/#custom-environments) there is an example that uses a custom shell script to read the branch and triggers a custom build:

package.json

"scripts": {
    "build": "./mybuild.sh",
},

mybuild.sh

#!/bin/bash
if [ "$CI_GIT_REF" = "master" ]; then
    npx ionic build --prod
else
    npx ionic build
fi

I am trying this exact code and seem to get a permission error when attempting to package the build. Wondering what deal is or if I am doing something wrong. Thanks.

> ./mybuild.sh

sh: ./mybuild.sh: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! vipcrowd@1.0.0 build: `./mybuild.sh`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the vipcrowd@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ionic/.npm/_logs/2019-01-04T22_29_55_359Z-debug.log

EDIT: My end goal is to use different build scripts based on the env and eventually have different cordova plugin variables based on env. So either a fix to this or alternate method would help greatly.