Skip to main content

Setting up the CodePush CLI

The CodePush CLI can be installed in two ways: as a Bitrise CLI plugin, or as a standalone binary. Both support the same commands. Use plugin mode if you already use the Bitrise CLI; use standalone mode if you want to run the CLI independently.

Plugin modeClick to copy link

In plugin mode, commands are prefixed with bitrise :codepush.

  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. Verify the installation:

    bitrise :codepush

You can manage the plugin with standard Bitrise CLI commands:

bitrise plugin list # confirm installation
bitrise plugin update codepush # upgrade to latest version
bitrise plugin uninstall codepush

Standalone modeClick to copy link

In standalone mode, commands are prefixed with codepush. The Bitrise CLI is not required.

  1. Download the binary for your platform from the Releases page:

    PlatformBinary
    macOS (Apple Silicon)codepush-Darwin-arm64
    macOS (Intel)codepush-Darwin-x86_64
    Linux (x86_64)codepush-Linux-x86_64
  2. Make it executable and move it to your PATH:

    chmod +x codepush-Darwin-arm64
    mv codepush-Darwin-arm64 /usr/local/bin/codepush
  3. Verify the installation:

    codepush version
Differences from plugin mode

In standalone mode, BITRISE_BUILD_NUMBER, BITRISE_DEPLOY_DIR, and GIT_CLONE_COMMIT_HASH are not auto-populated, and envman exports (CODEPUSH_UPDATE_ID, CODEPUSH_APP_VERSION, CODEPUSH_LABEL) are unavailable for downstream steps.

Setting a custom server URLClick to copy link

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.

note

The examples use plugin mode syntax. In standalone mode, replace bitrise :codepush with codepush.

There are three ways to do so:

  • Use any 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