This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
开始使用 EAS 工作流
了解如何使用 EAS Workflows 自动化你的 React Native CI/CD 开发和发布流程。
本页面将引导你完成创建第一个 EAS 工作流的过程,以便构建并提交你的应用到应用商店。
🌐 This page walks you through the process of creating your first EAS Workflows for building and submitting your app to the app stores.
开始使用
🌐 Get started
4 要求
4 要求
1.
你需要注册一个 Expo 账户。
2.
你需要使用以下命令创建一个项目:
- npx create-expo-app@latest --template default@sdk-573.
你需要使用以下命令将项目与 EAS 同步。这将创建一个 EAS 项目并将其链接到你的本地项目:
- npx eas-cli@latest init4.
如果你的项目根目录中还没有 eas.json 文件,你需要添加一个:
- touch eas.json && echo "{}" > eas.json1
在项目根目录下创建一个名为 .eas/workflows 的目录,并在其中放置一个 YAML 文件。例如:.eas/workflows/create-production-builds.yml。
my-app.easworkflowscreate-production-builds.ymleas.json2
将以下 YAML 添加到 create-production-builds.yml 文件中:
🌐 Add the following YAML to the create-production-builds.yml file:
name: Create Production Builds jobs: build_android: type: build # This job type creates a production build for Android params: platform: android build_ios: type: build # This job type creates a production build for iOS params: platform: ios
上面的工作流程将同时为 Android 和 iOS 创建生产构建。要成功运行此工作流程,你首先需要 使用 EAS CLI 设置并构建你的项目。
🌐 The workflow above will create a production build for Android and iOS in parallel. To run this workflow successfully, you'll need to set up and build your project using EAS CLI first.
3
最后,使用以下命令运行工作流:
🌐 Finally, run the workflow with the following command:
- npx eas-cli@latest workflow:run create-production-builds.yml一旦操作完成,你可以在项目的工作流页面查看你的工作流运行情况。
🌐 Once you do, you can see your workflow running on your project's workflows page.
更多
🌐 More
使用 GitHub 事件自动化工作流程
🌐 Automate workflows with GitHub events
你可以通过将提交推送到你的 GitHub 仓库来触发工作流。你可以按照以下步骤将 GitHub 仓库链接到你的 EAS 项目:
🌐 You can trigger a workflow by pushing a commit to your GitHub repository. You can link a GitHub repo to your EAS project with the following steps:
- 导航到你项目的 GitHub 设置。
- 按照 UI 安装 GitHub 应用。
- 选择与 Expo 项目匹配的 GitHub 存储库并连接它。
然后,将 on 触发器 添加到你的工作流文件中。例如,如果你想在提交推送到 main 分支时触发工作流,可以添加以下内容:
🌐 Then, add the on trigger to your workflow file. For example, if you want to trigger the workflow when a commit is pushed to the main branch, you can add the following:
name: Create Production Builds on: push: branches: ['main'] jobs: build_android: type: build params: platform: android build_ios: type: build params: platform: ios
从 App Store Connect 事件触发工作流
🌐 Trigger workflows from App Store Connect events
你也可以使用 on.app_store_connect 从 App Store Connect 事件触发工作流。
🌐 You can also trigger workflows from App Store Connect events using on.app_store_connect.
在使用 App Store Connect 触发器之前,请在 EAS 仪表板中配置你的 App Store Connect 连接:
🌐 Before using App Store Connect triggers, configure your App Store Connect connection in EAS dashboard:
- 打开 EAS 仪表板并选择你的项目。
- 导航到 项目设置 > 常规 > 连接。
- 连接你的 App Store Connect 应用。
示例工作流程:
🌐 Example workflow:
name: React to App Store Connect events on: app_store_connect: app_version: states: - ready_for_review - waiting_for_review jobs: send_slack_notification: type: slack params: webhook_url: ${{ env.SLACK_WEBHOOK_URL }} message: 'App version is ready for review or waiting for review.'
VS Code 扩展
🌐 VS Code extension
下载 Expo 工具 VS Code 扩展,以获取工作流文件的描述和自动补齐。
🌐 Download the Expo Tools VS Code extension to get descriptions and autocompletions for your workflow files.
有反馈或功能请求?请给我们发送电子邮件至 workflows@expo.dev。