Files
life-echo/docs/app-expo-deploy.md

107 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# App Expo 部署文档
> app-expo 前端应用的 CI/CD 部署说明,基于 GitHub Actions无 EAS 依赖。
## 概述
统一部署 Pipeline 支持三个环境:
| 环境 | 触发源 | 用途 |
|------|--------|------|
| **dev** | `main` 分支 | 开发 + 内部测试 |
| **stage** | `staging` 分支 | 预发布 |
| **prod** | `v*.*.*` 标签 | 正式发布 |
## 环境映射
环境由触发源自动推断,无需额外配置:
```
main → dev
staging → stage
v*.*.* → prod
```
## 触发条件
- **Push**:推送至 `main` / `staging``v*.*.*` 标签
- **路径过滤**:仅当 `app-expo/``.github/workflows/app-expo-deploy.yml` 有变更时触发
- **手动触发**`workflow_dispatch` 可选择 dev / stage / prod
## 使用方式
### Dev开发 + 内部测试)
```bash
git push origin main
```
合并后自动执行:质量检查、构建、上传 artifact保留 14 天)。
### Stage预发布
```bash
git push origin staging
```
若没有 `staging` 分支,可先创建:
```bash
git checkout -b staging
git push -u origin staging
```
构建产物保留 30 天。
### Prod正式发布
```bash
git tag v1.0.0
git push origin v1.0.0
```
将自动:构建、打包 zip、创建 GitHub Release、上传 artifact保留 90 天)。
### 手动触发
1. 打开仓库 **Actions** 标签
2. 选择 **App Expo Deploy**
3. 点击 **Run workflow**
4. 选择环境dev / stage / prod
5. 若选 prod可填写版本号`1.0.0`
## 版本规则SemVer
| 类型 | 示例 | 说明 |
|------|------|------|
| **PATCH** | v1.0.0 → v1.0.1 | bug 修复、小改动 |
| **MINOR** | v1.0.0 → v1.1.0 | 新功能、向后兼容 |
| **MAJOR** | v1.0.0 → v2.0.0 | 重大变更、不兼容 |
## 各环境行为
| 步骤 | dev | stage | prod |
|------|-----|-------|------|
| 质量检查format/lint/test | ✓ | - | - |
| Web 构建 | ✓ | ✓ | ✓ |
| 上传 artifact | ✓ (14 天) | ✓ (30 天) | ✓ (90 天) |
| 创建 GitHub Release | - | - | ✓ |
## GitHub Environments
**Settings → Environments** 中可配置 `dev``staging``production`
- 为各环境配置独立 secrets
- 为 production 配置审批规则
- 环境与 workflow 自动关联
## 产物说明
- **dev / stage**`app-expo/dist` 目录(静态 Web 构建)
- **prod**`app-expo-v{version}-web.zip`,附带于 GitHub Release
## 相关文件
- 工作流:`.github/workflows/app-expo-deploy.yml`
- 应用配置:`app-expo/app.config.ts`