构建并部署你的应用
现在你已经构建了第一个应用,你将希望将其分发出去,以便每个人都可以开始使用它。构建和部署应用的过程可能相当繁琐。这就是 Appflow 发挥作用的地方。Appflow 允许你有效地生成 Web 和原生构建,推送实时应用更新,将应用发布到应用商店,并自动化整个过程。完整的快速入门指南可以在 这里 找到。
🌐 Now that you have built your first app, you are going to want to get it distributed so everyone can start using it. The mechanics of building and deploying your application can be quite cumbersome. That is where Appflow comes into play. Appflow allows you to effectively generate web and native builds, push out live app updates, publish your app to the app stores, and automate the whole process. The entire Quickstart guide can be found here.
下面我们将概述这些步骤。
🌐 Below we will run through an overview of the steps.
连接你的存储库
🌐 Connect Your Repo
Appflow 直接与 Git 版本控制协作,并使用你现有的代码库作为部署和打包构建的真实来源。你首先需要与你的托管服务集成,例如 GitHub 或 Bitbucket,或者你可以将代码直接推送到 Appflow。一旦完成,Appflow 就可以访问你的代码。
🌐 Appflow works directly with Git version control and uses your existing code base as the source of truth for Deploy and Package builds. You will first need to integrate with your hosting service, such as GitHub or Bitbucket, or you can push your code directly to Appflow. Once this is completed, Appflow will have access to your code.
有关将你的代码仓库连接到 Appflow 的更多信息,请查看 Appflow 文档中的 连接你的仓库 部分。
🌐 For more on connecting your code repository to Appflow, checkout the Connect your Repo section inside the Appflow docs.
安装 Appflow SDK
🌐 Install the Appflow SDK
Appflow SDK(也称为 Ionic Deploy 插件)将允许你利用可以说是 Appflow 两个最佳功能:向你的应用部署实时更新以及绕过应用商店。Ionic Appflow 的实时更新功能随 Appflow SDK 一起提供,并具有检测和同步你在仪表板中已推送到已识别通道的应用更新的能力。
🌐 The Appflow SDK (also known as Ionic Deploy plugin) will allow you to take advantage of arguably two of the best Appflow features: deploying live updates to your app and bypassing the app stores. Ionic Appflow's Live Update feature is shipped with Appflow SDK and features the capabilities of detecting and syncing the updates for your app that you have pushed to your identified channels within the dashboard.
要将 Appflow SDK 插件添加到你的项目中,你可以在 Appflow 仪表板中点击 Deploy > Destinations 部分内的“安装说明”来遵循安装说明。或者,你也可以在应用的根目录中执行以下命令手动安装该插件:
🌐 To get the Appflow SDK plugin added to your project, you can follow the install instructions within the Appflow Dashboard by clicking on "Install Instructions" inside of the Deploy > Destinations section. Alternatively, you can install the plugin manually by executing the following command in your app's root directory:
ionic deploy add \
--app-id="YOUR_APP_ID" \
--channel-name="YOUR_CHANNEL_NAME" \
--update-method="background|auto|none" \
有关安装 Appflow SDK 的先决条件和附加说明,请访问 Appflow 文档中的 安装 Appflow SDK 部分。
🌐 For prerequisite and additional instructions on installing the Appflow SDK, visit the Install the Appflow SDK section inside the Appflow docs.
推送提交
🌐 Push a Commit
为了让 Appflow 访问你代码的最新和最重要的更改,你需要通过你选择的版本控制集成推送一次提交。对于使用 GitHub 或 Bitbucket 的用户,操作如下:
🌐 In order for Appflow to access the latest and greatest changes to your code, you will need to push a commit via the version control integration of your choosing. For those that use GitHub or Bitbucket, this would look as follows:
git add . # stage any changes
git commit -m "added appflow sdk" # commit staged changes
git push origin main # push the changes from the main branch to your git host
推送完成后,你将会在 Appflow 仪表板的 Commits 标签下看到你的提交。更多信息,请查看 Appflow 文档中的 推送提交 部分。
🌐 After the push is made, you will then see your commit under the Commits tab of the Appflow Dashboard. For more on this, take a look at the Push a Commit section inside the Appflow docs.
部署实时更新
🌐 Deploy a Live Update
安装了 Appflow SDK 并将提交推送到仪表板后,你就可以准备将实时更新部署到设备了。实时更新功能使用已安装的 Appflow SDK 与你的原生应用一起,监听特定的部署通道目标。当实时更新被分配到某个通道目标时,该更新将部署到运行已配置为监听该特定通道目标二进制文件的用户设备上。
🌐 With the Appflow SDK installed and your commit pushed up to the Dashboard, you are ready to deploy a live update to a device. The Live Update feature uses the installed Appflow SDK with your native application to listen to a particular Deploy Channel Destination. When a live update is assigned to a Channel Destination, that update will be deployed to user devices running binaries that are configured to listen to that specific Channel Destination.
要部署实时更新,需要创建一个 Web 构建。这可以通过 Commits 选项卡中的 Start build 图标或点击 Build > Builds 选项卡右上角的 New build 按钮来完成。选择要部署的正确提交后,选择 Web 目标平台和 Latest 构建堆栈。根据你的 Appflow 计划,如果配置了自定义环境,你将能够包含它们。最后,你可以启用 Live Update 并选择通道,以在构建成功完成后自动分配该构建。
🌐 To get the live update deployed, a Web build will need to be created. This can be done through the Start build icon from the Commits tab or by clicking the New build button in the top right corner of the Build > Builds tab. After selecting the correct commit to deploy, select the Web target platform and the Latest build stack. Depending on your Appflow plan, you will then be able to include custom environments, if any are configured. Finally, you can enable Live Update and pick the Channel to automatically assign the build to once it successfully completes.
在完成 Web 构建后,你可以使用额外的版本控制选项。在完成此部分并且成功完成部署构建后,你可以通过点击构建详情页面中的 Deploy live updates 按钮,将其分配到你在安装 Appflow SDK 时配置的相同通道。同样,你也可以在 Build > Builds 选项卡中点击构建上的 Deploy live updates 图标,并从下拉菜单中选择通道。
🌐 Upon completion of the Web Build, additional versioning options are available to you. After completing this section and you have a successful Deploy build, you can then assign it to the same Channel you configured the Appflow SDK to listen to when you installed it by clicking the Deploy live updates button in the build detail page. The same can be done by clicking the Deploy live updates icon on the build in the Build > Builds tab and select the Channel from the dropdown.
要接收此实时更新,你需要在设备或模拟器上运行该应用。实现此操作最快且最简单的方法是通过以下命令:
🌐 To receive this live update, you will need to run the app on a device or an emulator. The quickest and easiest way to do this is through the following command:
ionic cordova run [ios | android] [options]