Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 0091878

Browse files
author
Igor Krasavin
authored
Replace code-push CLI commands (#1926)
1 parent af75ca2 commit 0091878

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -260,33 +260,35 @@ This is not necessarily the case for `updateDialog`, since it won't force the us
260260
261261
## Releasing Updates
262262
263-
Once your app has been configured and distributed to your users, and you've made some JS and/or asset changes, it's time to instantly release them! The simplest (and recommended) way to do this is to use the `release-react` command in the CodePush CLI, which will handle bundling your JavaScript and asset files and releasing the update to the CodePush server.
263+
Once your app is configured and distributed to your users, and you have made some JS or asset changes, it's time to release them. The recommended way to release them is using the `release-react` command in the App Center CLI, which will bundle your JavaScript files, asset files, and release the update to the CodePush server.
264264

265-
In it's most basic form, this command only requires two parameters: your app name and the platform you are bundling the update for (either `ios` or `android`).
265+
*NOTE: Before you can start releasing updates, please log into App Center by running the `appcenter login` command.*
266+
267+
In its most basic form, this command only requires one parameter: your owner name + "/" + app name.
266268

267269
```shell
268-
code-push release-react <appName> <platform>
270+
appcenter codepush release-react -a <ownerName>/<appName>
269271
270-
code-push release-react MyApp-iOS ios
271-
code-push release-react MyApp-Android android
272+
appcenter codepush release-react -a <ownerName>/MyApp-iOS
273+
appcenter codepush release-react -a <ownerName>/MyApp-Android
272274
```
273275

274276
The `release-react` command enables such a simple workflow because it provides many sensible defaults (like generating a release bundle, assuming your app's entry file on iOS is either `index.ios.js` or `index.js`). However, all of these defaults can be customized to allow incremental flexibility as necessary, which makes it a good fit for most scenarios.
275277
276278
```shell
277279
# Release a mandatory update with a changelog
278-
code-push release-react MyApp-iOS ios -m --description "Modified the header color"
280+
appcenter codepush release-react -a <ownerName>/MyApp-iOS -m --description "Modified the header color"
279281
280282
# Release an update for an app that uses a non-standard entry file name, and also capture
281283
# the sourcemap file generated by react-native bundle
282-
code-push release-react MyApp-iOS ios --entryFile MyApp.js --sourcemapOutput ../maps/MyApp.map
284+
appcenter codepush release-react -a <ownerName>/MyApp-iOS --entry-file MyApp.js --sourcemap-output ../maps/MyApp.map
283285
284286
# Release a dev Android build to just 1/4 of your end users
285-
code-push release-react MyApp-Android android --rollout 25% --dev true
287+
appcenter codepush release-react -a <ownerName>/MyApp-Android --rollout 25% --development true
286288
287289
# Release an update that targets users running any 1.1.* binary, as opposed to
288290
# limiting the update to exact version name in the build.gradle file
289-
code-push release-react MyApp-Android android --targetBinaryVersion "~1.1.0"
291+
appcenter codepush release-react -a <ownerName>/MyApp-Android --target-binary-version "~1.1.0"
290292
291293
```
292294
@@ -302,19 +304,19 @@ If you run into any issues, or have any questions/comments/feedback, you can pin
302304
303305
In our [getting started](#getting-started) docs, we illustrated how to configure the CodePush plugin using a specific deployment key. However, in order to effectively test your releases, it is critical that you leverage the `Staging` and `Production` deployments that are auto-generated when you first created your CodePush app (or any custom deployments you may have created). This way, you never release an update to your end users that you haven't been able to validate yourself.
304306

305-
*NOTE: Our client-side rollback feature can help unblock users after installing a release that resulted in a crash, and server-side rollbacks (i.e. `code-push rollback`) allow you to prevent additional users from installing a bad release once it's been identified. However, it's obviously better if you can prevent an erroneous update from being broadly released in the first place.*
307+
*NOTE: Our client-side rollback feature can help unblock users after installing a release that resulted in a crash, and server-side rollbacks (i.e. `appcenter codepush rollback`) allow you to prevent additional users from installing a bad release once it's been identified. However, it's obviously better if you can prevent an erroneous update from being broadly released in the first place.*
306308

307309
Taking advantage of the `Staging` and `Production` deployments allows you to achieve a workflow like the following (feel free to customize!):
308310

309-
1. Release a CodePush update to your `Staging` deployment using the `code-push release-react` command (or `code-push release` if you need more control)
311+
1. Release a CodePush update to your `Staging` deployment using the `appcenter codepush release-react` command (or `appcenter codepush release` if you need more control)
310312

311313
2. Run your staging/beta build of your app, sync the update from the server, and verify it works as expected
312314

313-
3. Promote the tested release from `Staging` to `Production` using the `code-push promote` command
315+
3. Promote the tested release from `Staging` to `Production` using the `appcenter codepush promote` command
314316

315317
4. Run your production/release build of your app, sync the update from the server and verify it works as expected
316318

317-
*NOTE: If you want to get really fancy, you can even choose to perform a "staged rollout" as part of #3, which allows you to mitigate additional potential risk with the update (like did your testing in #2 touch all possible devices/conditions?) by only making the production update available to a percentage of your users (for example `code-push promote <APP_NAME> Staging Production -r 20%`). Then, after waiting for a reasonable amount of time to see if any crash reports or customer feedback comes in, you can expand it to your entire audience by running `code-push patch <APP_NAME> Production -r 100%`.*
319+
*NOTE: If you want to take a more cautious approach, you can even choose to perform a "staged rollout" as part of #3, which allows you to mitigate additional potential risk with the update (like did your testing in #2 touch all possible devices/conditions?) by only making the production update available to a percentage of your users (for example `appcenter codepush promote -a <ownerName>/<appName> -s Staging -d Production -r 20`). Then, after waiting for a reasonable amount of time to see if any crash reports or customer feedback comes in, you can expand it to your entire audience by running `appcenter codepush patch -a <ownerName>/<appName> Production -r 100`.*
318320

319321
You'll notice that the above steps refer to a "staging build" and "production build" of your app. If your build process already generates distinct binaries per "environment", then you don't need to read any further, since swapping out CodePush deployment keys is just like handling environment-specific config for any other service your app uses (like Facebook). However, if you're looking for examples (**including demo projects**) on how to setup your build process to accommodate this, then refer to the following sections, depending on the platform(s) your app is targeting:
320322
@@ -346,10 +348,10 @@ Since we recommend using the `Staging` deployment for pre-release testing of you
346348
347349
```javascript
348350
// #1) Create your new deployment to hold releases of a specific app variant
349-
code-push deployment add [APP_NAME] test-variant-one
351+
appcenter codepush deployment add -a <ownerName>/<appName> test-variant-one
350352
351353
// #2) Target any new releases at that custom deployment
352-
code-push release-react [APP_NAME] ios -d test-variant-one
354+
appcenter codepush release-react -a <ownerName>/<appName> -d test-variant-one
353355
```
354356
355357
*NOTE: The total user count that is reported in your deployment's "Install Metrics" will take into account users that have "switched" from one deployment to another. For example, if your `Production` deployment currently reports having 1 total user, but you dynamically switch that user to `Staging`, then the `Production` deployment would report 0 total users, while `Staging` would report 1 (the user that just switched). This behavior allows you to accurately track your release adoption, even in the event of using a runtime-based deployment redirection solution.*
@@ -382,7 +384,7 @@ Additionally, if you're looking to get started with React Native + CodePush, and
382384

383385
The `sync` method includes a lot of diagnostic logging out-of-the-box, so if you're encountering an issue when using it, the best thing to try first is examining the output logs of your app. This will tell you whether the app is configured correctly (like can the plugin find your deployment key?), if the app is able to reach the server, if an available update is being discovered, if the update is being successfully downloaded/installed, etc. We want to continue improving the logging to be as intuitive/comprehensive as possible, so please [let us know](mailto:[email protected]) if you find it to be confusing or missing anything.
384386
385-
The simplest way to view these logs is to run the `code-push debug` command for the specific platform you are currently working with (e.g. `code-push debug ios`). This will output a log stream that is filtered to just CodePush messages, for the specified platform. This makes it easy to identify issues, without needing to use a platform-specific tool, or wade through a potentially high volume of logs.
387+
The simplest way to view these logs is to add the flag `--debug` for each command. This will output a log stream that is filtered to just CodePush messages. This makes it easy to identify issues, without needing to use a platform-specific tool, or wade through a potentially high volume of logs.
386388
387389
<img width="540" alt="screen shot 2016-06-21 at 10 15 42 am" src="https://cloud.githubusercontent.com/assets/116461/16246973/838e2e98-37bc-11e6-9649-685f39e325a0.png">
388390
@@ -404,7 +406,7 @@ Now you'll be able to see CodePush logs in either debug or release mode, on both
404406
|-----------------|-------------------|
405407
| Compilation Error | Double-check that your version of React Native is [compatible](#supported-react-native-platforms) with the CodePush version you are using. |
406408
| Network timeout / hang when calling `sync` or `checkForUpdate` in the iOS Simulator | Try resetting the simulator by selecting the `Simulator -> Reset Content and Settings..` menu item, and then re-running your app. |
407-
| Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the deployment key you added to your `Info.plist` (iOS), `build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `code-push deployment ls [APP_NAME] -k` to view the correct keys for your app deployments. |
409+
| Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the deployment key you added to your `Info.plist` (iOS), `build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appcenter codepush deployment list <ownerName>/<appName> --displayKeys` to view the correct keys for your app deployments. |
408410
| Update not being discovered | Double-check that the version of your running app (like `1.0.0`) matches the version you specified when releasing the update to CodePush. Additionally, make sure that you are releasing to the same deployment that your app is configured to sync with. |
409411
| Update not being displayed after restart | If you're not calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyApplicationReady` on app start, otherwise, the plugin will think your update failed and roll it back. |
410412
| I've released an update for iOS but my Android app also shows an update and it breaks it | Be sure you have different deployment keys for each platform in order to receive updates correctly |

docs/multi-deployment-testing-android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your CodePush staging deployment key and your release builds to use your CodePush production deployment key.
88

9-
*NOTE: As a reminder, you can retrieve these keys by running `code-push deployment ls <APP_NAME> -k` from your terminal.*
9+
*NOTE: As a reminder, you can retrieve these keys by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` from your terminal.*
1010

1111
To set this up, perform the following steps:
1212

docs/multi-deployment-testing-ios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ To set this up, perform the following steps:
4444

4545
![Setting Keys](https://cloud.githubusercontent.com/assets/8598682/16821919/fc1eac4a-490d-11e6-9b11-128129c24b80.png)
4646

47-
*NOTE: As a reminder, you can retrieve these keys by running `code-push deployment ls <APP_NAME> -k` from your terminal.*
47+
*NOTE: As a reminder, you can retrieve these keys by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` from your terminal.*
4848

4949
9. Open your project's `Info.plist` file and change the value of your `CodePushDeploymentKey` entry to `$(CODEPUSH_KEY)`
5050

docs/setup-android.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ In order to integrate CodePush into your Android project, please perform the fol
5959
```
6060
6161
4. Add the Deployment key to `strings.xml`:
62-
63-
To let the CodePush runtime know which deployment it should query for updates, open your app's `strings.xml` file and add a new string named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `code-push deployment ls <appName> -k` in the CodePush CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Deployment Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. The "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
62+
63+
To let the CodePush runtime know which deployment it should query for updates, open your app's `strings.xml` file and add a new string named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` in the CodePush CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. The "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
6464
6565
![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
6666
@@ -101,7 +101,7 @@ In order to accommodate as many developer preferences as possible, the CodePush
101101
102102
*Note: If you don't already have RNPM installed, you can do so by simply running `npm i -g rnpm` and then executing the above command.*
103103
104-
2. If you're using RNPM >=1.6.0, you will be prompted for the deployment key you'd like to use. If you don't already have it, you can retrieve this value by running `code-push deployment ls <appName> -k`, or you can choose to ignore it (by simply hitting `<ENTER>`) and add it in later. To get started, we would recommend just using your `Staging` deployment key, so that you can test out the CodePush end-to-end.
104+
2. If you're using RNPM >=1.6.0, you will be prompted for the deployment key you'd like to use. If you don't already have it, you can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k`, or you can choose to ignore it (by simply hitting `<ENTER>`) and add it in later. To get started, we would recommend just using your `Staging` deployment key, so that you can test out the CodePush end-to-end.
105105
106106
And that's it for installation using RNPM! Continue below to the [Plugin Configuration](#plugin-configuration-for-react-native-lower-than-060-android) section to complete the setup.
107107
@@ -168,7 +168,7 @@ public class MainApplication extends Application implements ReactApplication {
168168
protected List<ReactPackage> getPackages() {
169169
// 3. Instantiate an instance of the CodePush runtime and add it to the list of
170170
// existing packages, specifying the right deployment key. If you don't already
171-
// have it, you can run "code-push deployment ls <appName> -k" to retrieve your key.
171+
// have it, you can run "appcenter codepush deployment list -a <ownerName>/<appName> -k" to retrieve your key.
172172
return Arrays.<ReactPackage>asList(
173173
new MainReactPackage(),
174174
new CodePush("deployment-key-here", MainApplication.this, BuildConfig.DEBUG)
@@ -245,7 +245,7 @@ public class MainActivity extends ReactActivity {
245245
protected List<ReactPackage> getPackages() {
246246
// 3. Instantiate an instance of the CodePush runtime and add it to the list of
247247
// existing packages, specifying the right deployment key. If you don't already
248-
// have it, you can run "code-push deployment ls <appName> -k" to retrieve your key.
248+
// have it, you can run "appcenter codepush deployment list -a <ownerName>/<appName> -k" to retrieve your key.
249249
return Arrays.<ReactPackage>asList(
250250
new MainReactPackage(),
251251
new CodePush("deployment-key-here", this, BuildConfig.DEBUG)

0 commit comments

Comments
 (0)