codemagic-codepush
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodemagic CodePush Setup
Codemagic CodePush 配置指南
Set up and maintain OTA update delivery for React Native apps through Codemagic-hosted CodePush () across iOS and Android.
https://codepush.pro通过Codemagic托管的CodePush()为iOS和Android端的React Native应用搭建并维护OTA更新交付能力。
https://codepush.proExpected Output
预期输出
Produce an implementation plan and then concrete edits/commands that include:
- Native and JS integration steps for each requested platform.
- Copy-paste snippets for exact files (,
Info.plist,strings.xml,AppDelegate,MainApplication.kt).codemagic.yaml - CodePush app/deployment commands and how to retrieve deployment keys.
- A release, verification, and rollback path.
先输出落地方案,再提供具体的修改内容/命令,包含:
- 各个请求支持平台的原生端和JS端集成步骤
- 对应文件(、
Info.plist、strings.xml、AppDelegate、MainApplication.kt)的可直接复制粘贴的代码片段codemagic.yaml - CodePush应用/部署相关命令,以及获取部署密钥的方法
- 发布、验证和回滚流程
Workflow
工作流
- Confirm scope and prerequisites.
- Configure React Native client integration (JS + native).
- Configure Codemagic CI and CodePush CLI auth.
- Create platform apps/deployments and wire deployment keys.
- Release to , verify, then promote to
Staging.Production - Troubleshoot or rollback if verification fails.
- 确认实施范围和前置条件
- 配置React Native客户端集成(JS + 原生端)
- 配置Codemagic CI和CodePush CLI鉴权
- 创建各平台应用/部署环境,配置对应部署密钥
- 发布到(预发环境)验证通过后,升级到
Staging(生产环境)Production - 如果验证失败,进行问题排查或回滚
Step 1: Confirm Scope And Prerequisites
步骤1:确认实施范围和前置条件
Do the following first:
- Confirm the project is React Native (pure Expo managed workflow is not supported by the plugin setup).
- Confirm Codemagic has provisioned a CodePush access token for the team.
- Confirm whether the user wants setup for both platforms or only one.
- Use separate CodePush app names per platform (for example ,
MyApp-iOS).MyApp-Android
If prerequisites are missing, stop and list what is needed.
首先完成以下确认:
- 确认项目是React Native项目(纯Expo托管工作流不支持该插件配置)
- 确认Codemagic已经为团队分配了CodePush访问令牌
- 确认用户需要双平台配置还是仅单个平台
- 不同平台使用独立的CodePush应用名称(例如、
MyApp-iOS)MyApp-Android
如果不满足前置条件,停止操作并列出所需的缺失条件。
Step 2: Configure React Native Client Integration
步骤2:配置React Native客户端集成
- Install plugin dependency:
yarn add @code-push-next/react-native-code-push
- Wrap the app root component:
import codePush from "@code-push-next/react-native-code-push";export default codePush(App);
- Apply platform-native wiring:
- iOS details: references/setup-ios.md
- Android details: references/setup-android.md
Always set both server URL and deployment key in native config:
- iOS keys:
Info.plist,CodePushServerURLCodePushDeploymentKey - Android keys:
strings.xml,CodePushServerUrlCodePushDeploymentKey
- 安装插件依赖:
yarn add @code-push-next/react-native-code-push
- 包裹应用根组件:
import codePush from "@code-push-next/react-native-code-push";export default codePush(App);
- 完成对应平台的原生端接入:
- iOS详细说明:references/setup-ios.md
- Android详细说明:references/setup-android.md
务必在原生配置中同时设置服务端URL和部署密钥:
- iOS 配置项:
Info.plist、CodePushServerURLCodePushDeploymentKey - Android 配置项:
strings.xml、CodePushServerUrlCodePushDeploymentKey
Step 3: Configure Codemagic CI + CLI
步骤3:配置Codemagic CI + CLI
Follow references/codepush-releases-codemagic-ci.md and references/codepush-cli.md to ensure:
- is installed in workflow scripts.
@codemagic/code-push-cli - Login uses Codemagic server URL and token from environment variables.
- Release commands target explicit platform app names and deployment channels.
Use https://github.com/codemagic-ci-cd/code-push-pro for CLI reference and ensure all commands align with the current CLI behavior, calling out any discrepancies from project docs.
参考 references/codepush-releases-codemagic-ci.md 和 references/codepush-cli.md 确保满足以下要求:
- 工作流脚本中已安装
@codemagic/code-push-cli - 登录使用环境变量中存储的Codemagic服务端URL和令牌
- 发布命令指定明确的平台应用名称和部署渠道
可参考 https://github.com/codemagic-ci-cd/code-push-pro 获取CLI使用说明,确保所有命令符合当前CLI的实际行为,若与项目文档存在差异需明确指出。
Step 4: Verify End-To-End
步骤4:端到端验证
Follow references/verification-and-troubleshooting.md:
- Release to first.
Staging - Validate update delivery and metrics.
- Promote from to
Stagingonly after validation.Production
参考 references/verification-and-troubleshooting.md:
- 首先发布到(预发环境)
Staging - 验证更新交付能力和相关指标
- 仅在验证通过后从(预发环境)升级到
Staging(生产环境)Production
Execution Rules
执行规则
- Prefer exact file edits and commands over abstract guidance.
- Keep platform differences explicit; never merge iOS and Android deployment keys.
- Use long-form CLI flags when ambiguity exists (for example ).
--targetBinaryVersion - If a command in project docs differs from CLI docs, call out the difference and choose the current CLI behavior.
- 优先提供明确的文件修改内容和命令,而非抽象指导
- 明确标注平台差异,绝对不要混用iOS和Android的部署密钥
- 存在歧义时使用CLI完整参数(例如)
--targetBinaryVersion - 如果项目文档中的命令与CLI官方文档不一致,需指出差异并采用当前CLI的实际行为。