首页指南参考教程

使用 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.

上图直观地显示了此链接。在这里,我们的构建将 "production" 通道链接到名为 "版本-1.0" 的分支。当我们准备好后,我们可以调整通道分支指针。想象一下,我们在名为 "版本-2.0" 的分支上测试并准备了更多修复程序。我们可以更新此链接,使 "版本-2.0" 分支可用于具有 "production" 通道的所有构建。

¥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:

Terminal
eas channel:list

查看特定通道:

¥View a specific channel:

Terminal
eas channel:view [channel-name]

# Example
eas channel:view production

创建通道:

¥Create a channel:

Terminal
eas channel:create [channel-name]

# Example
eas channel:create production

视察分行

¥Inspect branches

查看所有分支:

¥See all branches:

Terminal
eas branch:list

查看特定分支及其更新列表:

¥See a specific branch and a list of its updates:

Terminal
eas branch:view [branch-name]


# Example
eas branch:view version-1.0

检查更新

¥Inspect updates

查看具体更新:

¥View a specific update:

Terminal
eas update:view [update-group-id]

# Example
eas update:view dbfd479f-d981-44ce-8774-f2fbcc386aa

更改项目更新的状态

¥Changing the state of your project's updates

创建新更新并发布

¥Create a new update and publish it

Terminal
eas update --branch [branch-name] --message "..."

# Example
eas update --branch version-1.0 --message "Fixes typo"

如果你使用 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.

Terminal
eas update --auto

删除分支

¥Delete a branch

Terminal
eas branch:delete [branch-name]

# Example
eas branch:delete version-1.0

重命名分支

¥Rename a branch

重命名分支不会断开任何通道-分支链接。如果你将名为 "production" 的通道链接到名为 "版本-1.0" 的分支,然后将名为 "版本-1.0" 的分支重命名为 "版本-1.0-新",则 "production" 通道将链接到现在重命名的分支 "版本-1.0-新"。

¥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".

Terminal
eas branch:rename --from [branch-name] --to [branch-name]

# Example
eas branch:rename --from version-1.0 --to 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 历史记录的顶部。

¥Republish is similar to a Git reversion, where the correct commit is placed on top of the Git history.

Terminal
eas update:republish --group [update-group-id]
eas update:republish --branch [branch-name]

# Example
eas update:republish --group dbfd479f-d981-44ce-8774-f2fbcc386aa
eas update:republish --branch version-1.0

如果你不知道确切的更新组 ID,可以使用 --branch 标志。这会显示分支上最近更新的列表,并允许你选择要重新发布的更新组。

¥If you don't know the exact update group ID, you can use the --branch flag. This shows a list of the recent updates on the branch and allows you to select the update group to republish.

Expo 中文网 - 粤ICP备13048890号