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.
-
Run the following command:
bitrise plugin install --source https://github.com/bitrise-io/bitrise-plugins-codepush-cli.git -
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.
-
Download the binary for your platform from the Releases page:
Platform Binary macOS (Apple Silicon) codepush-Darwin-arm64macOS (Intel) codepush-Darwin-x86_64Linux (x86_64) codepush-Linux-x86_64 -
Make it executable and move it to your PATH:
chmod +x codepush-Darwin-arm64mv codepush-Darwin-arm64 /usr/local/bin/codepush -
Verify the installation:
codepush version
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.
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-urlflag:bitrise :codepush push --server-url https://api.staging.bitrise.io -
Export the
CODEPUSH_SERVER_URLEnvironment Variable:export CODEPUSH_SERVER_URL=https://api.staging.bitrise.io -
Set the server URL during initializing with the
initcommand. This writes the URL into the.codepush.jsonfile:bitrise :codepush init --server-url https://api.staging.bitrise.io
The server URL is resolved in the following order:
- The
--server-urlflag (highest priority) - The
CODEPUSH_SERVER_URLenvironment variable - The
server_urlfield in the.codepush.jsonfile. - Default: https://api.bitrise.io