An example of how to use CodePush with an Ionic/Cordova app.
- Install the CodePush CLI
npm install -g code-push-cli
- Register and login
code-push register
code-push login
- CodePush uses Github/Microsoft Live accounts for authentication. However, you will want to create a shared login which can be used by multiple devs.
code-push access-key add "shared login for my account"
- Use the access key generated by the above command to login. Warning this gives full access to all your apps. To avoid that, create a Github account for the project and use that to generate the access key.
code-push login --accessKey <accessKey>
- Create a new app.
code-push app add <appName>
- Create deployment targets for iOS and Android. These keys need to be added to
config.xml
and can be used to fetch latest deployments tomaster
.
code-push deployment add <appName> ios
code-push deployment add <appName> android
- Add a deployment step to
circle.yml
. The following pushes updates to the master branch deployments, for both iOS and Android. And updates the versions list.
deployment:
staging:
branch: /.*/
commands:
- node deploy.js $CODE_PUSH_APP_NAME $APP_STORE_VERSION $CIRCLE_PR_NUMBER
- node ci-hook.js $CIRCLE_PROJECT_REPONAME
- The versions list is available at:
http://codepush-deployments-lists.s3-website-us-east-1.amazonaws.com/<yourRepName>-codepush-deployments.json