Skip to main content

Setting up the CodePush plugin

Abstract

To use the CodePush CLI plugin, install the plugin with the Bitrise CLI. Optionally, you can set it up with a custom server URL.

Installing the CodePush CLI plugin

Install the CodePush CLI plugin so that you can use CodePush locally, on your own machines.

  1. Install the Bitrise CLI.

  2. Run the following command:

    bitrise plugin install --source https://github.com/bitrise-io/bitrise-plugins-codepush-cli.git
  3. Run the plugin:

    bitrise :codepush

Setting a custom server URL

Set a different target environment for CodePush instead of the main Bitrise server. For example, you can set a staging environment as the base server URL.

There are three ways to do so:

  • Use the push command with the --server-url flag:

    bitrise :codepush push --server-url https://api.staging.bitrise.io
  • Export the $CODEPUSH_SERVER_URL Environment Variable:

    export CODEPUSH_SERVER_URL=https://api.staging.bitrise.io
  • Set the server URL during initializing with the init command. This writes the URL into the .codepush.json file:

    bitrise :codepush init --server-url https://api.staging.bitrise.io

The server URL is resolved in the following order:

  1. The --server-url flag (highest priority)

  2. The CODEPUSH_SERVER_URL environment variable

  3. The server_url field in the .codepush.json file.

  4. Default: https://api.bitrise.io