This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
使用 EAS CLI 管理分支和渠道
了解如何将分支链接到通道并使用 EAS CLI 发布更新。
EAS 更新通过将 分支 与 通道 关联来工作。通道在构建时指定,并存在于构建的原生代码中。分支是一系列有序的更新,类似于 Git 分支,它是一个有序的提交列表。使用 EAS 更新,我们可以将任何通道链接到任何分支,从而允许我们向不同的构建提供不同的更新。
🌐 EAS Update works by linking branches to channels. Channels are specified at build time and exist inside a build's native code. Branches are an ordered list of updates, similar to a Git branch, which is an ordered list of commits. With EAS Update, we can link any channel to any branch, allowing us to make different updates available to different builds.
上图展示了这一关联。在这里,我们有与名为“version-1.0”的分支关联的“生产”通道的构建。当我们准备好时,可以调整通道与分支的指针。假设我们在名为“version-2.0”的分支上测试并准备了更多修复,可以更新此关联,使所有具有“生产”通道的构建都可使用“version-2.0”分支。
🌐 The diagram above visualizes this link. Here, we have the builds with the "production" channel linked to the branch named "version-1.0". When we're ready, we can adjust the channel–branch pointer. Imagine we have more fixes tested and ready on a branch named "version-2.0". We could update this link to make the "version-2.0" branch available to all builds with the "production" channel.
检查项目更新的状态
🌐 Inspecting the state of your project's updates
检查渠道
🌐 Inspect channels
查看所有通道:
🌐 View all channels:
查看特定通道:
🌐 View a specific channel:
创建通道:
🌐 Create a channel:
视察分行
🌐 Inspect branches
查看所有分支:
🌐 See all branches:
查看特定分支及其更新列表:
🌐 See a specific branch and a list of its updates:
检查更新
🌐 Inspect updates
查看具体更新:
🌐 View a specific update:
更改项目更新的状态
🌐 Changing the state of your project's updates
创建新更新并发布
🌐 Create a new update and publish it
如果你正在使用 Git,我们可以使用 --auto 标志来自动填写分支名称和信息。该标志将使用当前的 Git 分支作为分支名称,并使用最新的 Git 提交信息作为消息。
🌐 If you're using Git, we can use the --auto flag to auto-fill the branch name and the message. This flag will use the current Git branch as the branch name and the latest Git commit message as the message.
删除分支
🌐 Delete a branch
重命名分支
🌐 Rename a branch
重命名分支不会断开任何通道-分支的链接。如果你有一个名为“production”的通道链接到一个名为“version-1.0”的分支,然后你将名为“version-1.0”的分支重命名为“version-1.0-new”,那么“production”通道将会链接到现在已重命名的分支“version-1.0-new”上。
🌐 Renaming branches do not disconnect any channel–branch links. If you had a channel named "production" linked to a branch named "version-1.0", and then you renamed the branch named "version-1.0" to "version-1.0-new", the "production" channel would be linked to the now-renamed branch "version-1.0-new".
在分支内重新发布以前的更新
🌐 Republish a previous update within a branch
我们可以让之前的更新立即对所有用户可用。此命令会将之前的更新再次发布,从而使其成为分支上最新的更新。当用户重新打开应用时,应用将看到新重新发布的更新并进行下载。
🌐 We can make a previous update immediately available to all users. This command takes the previous update and publishes it again so that it becomes the most current update on the branch. As your users re-open their apps, the apps will see the newly re-published update and will download it.
重新发布类似于 Git 回退操作,即将正确的提交放置在 Git 历史的顶部。
如果你不知道确切的更新组 ID,你可以使用
--branch标志。这会显示该分支上最近更新的列表,并允许你选择要重新发布的更新组。
暂停该通道的更新
🌐 Pause updates on a channel
暂停一个通道会阻止 EAS Update 向在该通道上检查更新的构建提供更新。
🌐 Pausing a channel stops EAS Update from serving updates to builds that check for updates on that channel.
暂停是可逆的。当你取消暂停通道时,通道的更新和任何正在进行的推出都会恢复。
🌐 Pausing is reversible. Your channel's updates and any rollout in progress will resume when you unpause a channel.
在没有通道名称的情况下运行命令,可以从列表中选择一个。在持续集成(CI)中,传入通道名称使用 --non-interactive,或者使用 --json 将通道以 JSON 格式打印出来。--json 标志意味着 --non-interactive。
🌐 Run the command without a channel name to pick one from a list. In CI, pass the channel name with --non-interactive, or use --json to print the channel as JSON. The --json flag implies --non-interactive.
当通道被暂停时会发生什么?
- 暂停通道上的每个客户端仍会检查更新,但它们不会收到新的更新。对于暂停的通道,EAS 通常会返回一个没有内容的 HTTP 204 响应,所以这些检查几乎不占用带宽。
- 每个客户端都会继续运行它已经拥有的最新更新。如果客户端从未收到过更新,这可能就是随版本一起发布的代码。你的用户在使用的应用上不会看到任何变化。
- 因为没有客户下载更新,当通道暂停时,每月活跃用户的数量不会增加。这也导致计费用户的增长停滞。
eas channel:view [channel-name]和eas channel:list显示通道的状态为 已暂停。- 你可以继续向分支发布更新。它们会像平常一样被存储,并在你取消暂停通道时可用。
暂停只适用于单个通道,所以暂停 production 对 preview 或 development 通道没有影响。在生产环境暂停的同时,你仍然可以在开发和预览通道上继续发布和测试更新。
🌐 Pausing applies to a single channel, so pausing production has no effect on a preview or development channel. You can continue to publish and test updates on your development and preview channels while production is paused.
暂停通道和回滚有什么不同?
暂停会让客户端停留在当前的更新上,阻止它们接收新的更新,而回滚则是让客户端运行更早的更新。
🌐 Pausing keeps clients on their current update and prevents them from receiving new updates, while rollbacks instruct clients to run an older update.
eas update:rollback和eas update:republish再次发布之前的更新,这样它就变成分支上最新的更新。客户端会下载那个更新并运行它。参见 回滚。eas update:rollback带有嵌入选项,也可以作为eas update:roll-back-to-embedded使用,会发布一个指令,告诉客户端停止使用已下载的更新,而是运行构建中嵌入的更新。eas channel:pause不会发布任何内容,并指示 EAS 不要发送指定通道的更新。该通道上的客户端会继续运行当前拥有的最新更新,并且在通道恢复之前不会收到新的更新。
在通道上更新简历
🌐 Resume updates on a channel
通过恢复来取消暂停通道。通道将开始提供与该通道关联分支的更新。通道上的任何滚动发布将继续进行。当用户打开他们的应用并检查更新时,他们会像往常一样收到最新的兼容更新。
🌐 Unpause a channel by resuming it. The channel will start serving updates from the branch associated with the channel. Any rollout on the channel will resume. As users open their apps and check for updates, they will receive the newest compatible update as usual.