Expo Setup
@deploypulseio/react-native-code-push includes an Expo config plugin that configures all native files automatically during expo prebuild / eas build. No manual Xcode or Android Studio changes required.
Requirements: Expo SDK 52+, React Native 0.76+. See Compatibility for the
full matrix, including Expo Go and the expo-updates alternative to this guide.
Create the apps
On the CodePush protocol each platform is its own app with its own keys, so create two:
dpctl app add MyApp-iOS --platform expo-cng-ios
dpctl app add MyApp-Android --platform expo-cng-android
Each one comes with Production and Staging deployments. Both apps are configured from the one
app.json below: the iOS app's key goes in the ios block, the Android app's in the android block.
Configure app.json
{
"expo": {
"plugins": [
[
"@deploypulseio/react-native-code-push",
{
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_KEY"
},
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_KEY"
}
}
]
]
}
}
The server URL defaults to https://apps.deploypulse.io, so you only supply your deployment keys.
Both the ios and android blocks still need to be present: the plugin only configures a platform
it is given a block for, so omitting one means that platform is built without CodePush at all.
apps.deploypulse.io is the canonical hostname and is what every guide here uses. api.deploypulse.io
is a CNAME to the same service, so an app already configured with it keeps working and does not need
to be changed.
Retrieve each app's keys. They are hidden unless you ask for them:
dpctl deployment ls MyApp-iOS --displayKeys
dpctl deployment ls MyApp-Android --displayKeys
Use the Production key for builds you ship, and Staging for builds you test on.
Run prebuild
npx expo prebuild
# or let EAS Build handle it automatically
What the plugin configures
iOS (Info.plist):
CodePushDeploymentKeyCodePushServerURL= the value you set above
iOS (AppDelegate):
- Adds
import CodePush - Replaces
bundleURL()with CodePush-aware version
Android (strings.xml):
CodePushDeploymentKeyCodePushServerUrl= the value you set above (note the lower-caseUrlon Android)
Android (MainApplication.kt):
- Adds CodePush imports
- Initializes CodePush in
onCreate() - Adds
getJSBundleFile()override
Android (app/build.gradle):
- Appends
apply from: ".../codepush.gradle"
Release an update
An Expo app on the CodePush SDK releases like any React Native app: with dpctl release-react, one
app per platform. Run it from the project folder after npx expo prebuild:
dpctl release-react MyApp-iOS ios -d Production
dpctl release-react MyApp-Android android -d Production
dpctl reads the app version and whether Hermes is on from the native projects prebuild generates. If you don't run prebuild locally, for example because EAS Build does it for you, there is nothing to read, so pass both yourself:
dpctl release-react MyApp-iOS ios -d Production --targetBinaryVersion 1.0.0 --useHermes
--targetBinaryVersion is the version from your app config. Leave --useHermes off if the app uses
JavaScriptCore ("jsEngine": "jsc"). If your entry file isn't index.js, pass it with --entryFile.
Hermes compilation needs dpctl 1.2.0 or later.
This page is the CodePush path. Apps on expo-updates release with dpctl release-expo instead, see
Compatibility. If you run the wrong command for an app, dpctl stops and tells you
which one to use.
Point at a different server
Set serverUrl once at the top level, or CodePushServerURL per platform when the two differ. A
per-platform value wins over the top-level one:
{
"expo": {
"plugins": [
["@deploypulseio/react-native-code-push", {
"serverUrl": "https://your-server.example.com",
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_KEY"
},
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_KEY"
}
}]
]
}
}
Next step
Return to the React Native SDK page for usage and notifyAppReady instructions.
