Bundle React Native or Expo JavaScript and push it as an OTA update to Bitrise CodePush.
Description
Bundles the JavaScript code (and assets) of a React Native project and publishes it as an over-the-air (OTA) update to a Bitrise CodePush deployment.
- Add the Step to a Workflow after your JS dependencies are installed (or leave Skip dependency install unchecked and let the Step run the install for you).
- Set Target platform to
iosorandroid. Each run only bundles and publishes for one platform; to update both iOS and Android, add the Step twice, once per platform. - Set Release Management app ID and Deployment (name, e.g.
Staging, or UUID) for the app you're publishing to. - Set Target app version to the native app version this update targets (e.g.
1.2.0). - Set Bitrise API token as a Secret.
- Optionally set Rollout percentage, Mandatory update, and Disable after upload to control how the update is rolled out.
The Step auto-detects your project's entry file and Hermes bytecode configuration; overrides
are available under Bundling options if auto-detection doesn't fit your project layout.
Expo projects are supported too — the Step detects Expo vs. bare React Native automatically
from your project's package.json.
The built package is exported under $BITRISE_DEPLOY_DIR, so a subsequent
Deploy to Bitrise.io Step picks it up automatically and it shows up on the build's Artifacts
tab, with no extra wiring needed.
Add this step directly to your workflow in the Bitrise Workflow Editor.
You can also run this step directly with Bitrise CLI.
Inputs
| Key | Description | Flags | Default |
|---|---|---|---|
platform |
The platform the JavaScript bundle and update target. Each run of the Step bundles for a single platform (the bundle filename and entry file differ between iOS and Android). | required | ios |
app_id |
The UUID of the Release Management app (with CodePush enabled) this update targets. Find this on your Release Management app's CodePush page. | required | |
deployment |
The name (e.g. Staging, Production) or UUID of the deployment to work with. |
required | |
api_token |
A Bitrise API access token with access to the app above. Prefer a Workspace API token: unlike a personal access token, it isn't tied to any one team member's account, so it keeps working if that person leaves or their access changes. A Personal Access Token (generated under Account Settings > Security on bitrise.io) also works, but ties this Step's ability to publish updates to that individual's account. | required, sensitive | |
app_version |
The target native binary version(s) this update applies to. This is usually your app's marketing/short version string, not the build number. Accepts an exact version or a range expression: - Exact version: 1.2.3 — only devices on that exact binary version. - Wildcard: * — any device, regardless of binary version. - Partial version: 1.2.x or 1.2 — any patch version within that major.minor (1.2 is equivalent to >=1.2.0 <1.3.0). - Range: 1.2.3 - 1.2.7 (inclusive-inclusive) or >=1.2.3 <1.2.7 (inclusive-exclusive). - Semver operators: ~1.2.3 (equivalent to >=1.2.3 <1.3.0), ^1.2.3 (equivalent to >=1.2.3 <2.0.0). See Target versions for the full reference. |
required | |
rollout_percentage |
Percentage of devices, between 0 and 100, that receive this update immediately. Accepts fractional values (e.g. 33.3). Leave at 100 to roll the update out to all devices right away, or set a lower value to ramp up a staged rollout over time (adjustable later on the details page of the CodePush update in the Release Management app). |
100 |
|
mandatory |
When enabled, devices are forced to install this update (a "mandatory" or "forced" update) instead of being able to defer it. | false |
|
disabled_after_upload |
When enabled, the update is uploaded but not served to any device until manually enabled later on the details page of the CodePush update in the Release Management app. Useful for a "dark push" you plan to enable after separate verification. | false |
|
description |
Optional release notes / description for this update. Plain text only. | ||
project_dir |
The root directory of the React Native or Expo project to bundle, containing its package.json. |
$BITRISE_SOURCE_DIR |
|
entry_file |
Path to the JavaScript entry file, relative to Project directory. Leave empty to auto-detect (index.<platform>.js, then index.js, then the main field in package.json). |
||
hermes |
Controls whether the JavaScript bundle is compiled to Hermes bytecode after bundling. - auto: detect from the project's android/app/build.gradle / ios/Podfile, falling back to "enabled" for React Native >= 0.70 (where Hermes is the default engine) if no explicit setting is found. - on: always compile to Hermes bytecode. - off: never compile to Hermes bytecode. The compiled bundle must match the Hermes/JSC engine the native app was built with, or the update will fail to load on-device. |
auto |
|
bundle_name |
Overrides the output filename of the generated JS bundle. Leave empty to use the platform default (main.jsbundle for iOS, index.android.bundle for Android), or the filename auto-detected from your native project files (Expo only). |
||
skip_dependency_install |
When enabled, skips running npm install / yarn install / pnpm install / bun install before bundling. Enable this if a previous Step in the Workflow already installed the project's JS dependencies. |
false |
|
private_key_path |
Path to a PEM-encoded RSA private key (PKCS1 or PKCS8). When set, the Step signs the bundle after bundling and before the upload, by adding a .codepushrelease file to it. The CodePush SDK in your app verifies this signature with the matching public key. Store the key as a Secret File on Bitrise and set this input to the file's environment variable, for example $CODEPUSH_PRIVATE_KEY. Leave empty to publish an unsigned update. Once your app is built with a public key (CodePushPublicKey), the SDK rejects unsigned updates. See Code signing for how to generate the key pair and add the public key to your app. |
||
verbose_log |
Enable this to print additional information useful for debugging. | false |
Outputs
| Environment Variable | Description |
|---|---|
BITRISE_CODEPUSH_UPDATE_ID |
The package/update ID assigned to the pushed release. |
BITRISE_CODEPUSH_PACKAGE_PATH |
Local path to the built update package (a .zip). The Step copies it under $BITRISE_DEPLOY_DIR, so a subsequent Deploy to Bitrise.io Step picks it up automatically and it appears on the build's Artifacts tab. |
We welcome pull requests and issues against this repository.
For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.
Learn more about developing steps: