android-playstore-pipeline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAndroid Play Store Pipeline
Android Play Store 部署流水线
This skill orchestrates all five Android deployment skills to create a complete, production-ready Play Store deployment pipeline in one command.
该Skill可编排全部5项Android部署Skill,通过一条命令即可搭建一套完整的、可用于生产环境的Play Store部署流水线。
What This Does
功能说明
This is the "easy button" for Android deployment. It runs all five prerequisite skills in the correct order and creates a complete CI/CD pipeline from scratch.
这是Android部署的「一键操作按钮」。它会按正确顺序运行所有5项前置Skill,从零开始搭建一套完整的CI/CD流水线。
Complete Pipeline Setup
完整流水线搭建内容
-
Release Build Configuration (android-release-build-setup)
- Generate production and local dev keystores
- Configure ProGuard/R8 with safe defaults
- Setup signing configuration
- Update .gitignore for security
-
E2E Testing Setup (android-e2e-testing-setup)
- Add Espresso dependencies
- Create test directory structure
- Generate sample tests (smoke, navigation, interaction)
- Setup CI/CD test integration
-
Release Validation (android-release-validation)
- Create validation workflows
- Setup E2E testing on release builds
- Configure quality gates
- Generate validation reports
-
Play Console Integration (android-playstore-setup)
- Guide service account creation
- Enable Play Developer API
- Setup release notes structure
- Document GitHub Secrets
-
CI/CD Deployment (android-playstore-publishing)
- Generate deployment workflows
- Configure multi-track deployment
- Setup staged rollouts
- Create rollout management
-
发布构建配置 (android-release-build-setup)
- 生成生产环境和本地开发环境密钥库
- 使用安全默认值配置ProGuard/R8
- 设置签名配置
- 更新.gitignore以保障安全
-
E2E测试设置 (android-e2e-testing-setup)
- 添加Espresso依赖
- 创建测试目录结构
- 生成示例测试用例(冒烟测试、导航测试、交互测试)
- 配置CI/CD测试集成
-
发布验证 (android-release-validation)
- 创建验证工作流
- 在发布构建中设置E2E测试
- 配置质量门禁
- 生成验证报告
-
Play Console集成 (android-playstore-setup)
- 引导创建服务账号
- 启用Play Developer API
- 设置发布说明结构
- 记录GitHub Secrets配置方法
-
CI/CD部署 (android-playstore-publishing)
- 生成部署工作流
- 配置多渠道部署
- 设置分阶段发布
- 创建发布管理机制
Prerequisites
前置条件
Absolutely Required:
- Android project with Gradle wrapper
- Package name decided (e.g., com.example.app)
- Google Play Developer account ($25, one-time)
- Admin access to Google Play Console
Nice to Have:
- Git repository initialized
- GitHub repository (for CI/CD)
- Basic familiarity with Android development
You DON'T Need:
- Existing keystore (we'll create it)
- Existing tests (we'll generate samples)
- CI/CD experience (we'll set it up)
- Play Console experience (we'll guide you)
必须满足:
- 带有Gradle wrapper的Android项目
- 已确定包名(例如:com.example.app)
- Google Play开发者账号(一次性付费25美元)
- Google Play Console的管理员权限
建议满足:
- 已初始化Git仓库
- GitHub仓库(用于CI/CD)
- 基本熟悉Android开发
无需提前准备:
- 现有密钥库(我们会创建)
- 现有测试用例(我们会生成示例)
- CI/CD使用经验(我们会完成配置)
- Play Console使用经验(我们会提供引导)
Parameters
参数
None required - this skill will ask for everything it needs through an interactive questionnaire.
无需提前指定参数 - 该Skill会通过交互式问卷收集所需的全部信息。
Interactive Questionnaire
交互式问卷
The skill will ask strategic questions once, then execute all five skills with your answers:
该Skill会一次性询问关键问题,然后根据你的回答自动执行所有5项Skill:
1. Project Information
1. 项目信息
- "What is your Android project directory?" (default: current directory)
- "What is your app's package name?" (e.g., com.example.app)
- "What is your app name?" (for documentation)
- "What is your organization name?" (for keystore)
- 「你的Android项目目录是什么?」(默认:当前目录)
- 「你的应用包名是什么?」(例如:com.example.app)
- 「你的应用名称是什么?」(用于文档生成)
- 「你的组织名称是什么?」(用于密钥库)
2. Keystore Configuration
2. 密钥库配置
- "Organization unit?" (e.g., Engineering)
- "City/Locality?" (e.g., San Francisco)
- "State/Province?" (e.g., California)
- "Country code?" (e.g., US)
- 「组织部门?」(例如:Engineering)
- 「城市/地区?」(例如:San Francisco)
- 「州/省份?」(例如:California)
- 「国家代码?」(例如:US)
3. Testing Configuration
3. 测试配置
- "What is your main activity class name?" (e.g., MainActivity)
- "Which locales for release notes?" (default: en-US)
- "Enable test orchestrator?" (recommended: yes)
- 「你的主Activity类名是什么?」(例如:MainActivity)
- 「发布说明支持哪些地区语言?」(默认:en-US)
- 「是否启用测试编排器?」(推荐:是)
4. Deployment Configuration
4. 部署配置
- "Which deployment tracks to enable?"
- Internal (continuous deployment)
- Beta (alpha/beta testing)
- Production (staged rollout)
- "Enable manual approval for production?" (recommended: yes)
- 「要启用哪些发布渠道?」
- 内部测试(持续部署)
- 测试版(Alpha/Beta测试)
- 正式版(分阶段发布)
- 「正式版发布是否需要手动审批?」(推荐:是)
5. Play Console Setup
5. Play Console设置
- "Do you have a Google Play Developer account?" (guide if no)
- "Is your app created in Play Console?" (guide if no)
- "Run Play Console setup now or later?" (can defer to manual)
- 「你是否拥有Google Play开发者账号?」(如果没有会提供引导)
- 「你是否已在Play Console中创建应用?」(如果没有会提供引导)
- 「现在还是稍后进行Play Console设置?」(可推迟至手动操作)
Step-by-Step Execution
分步执行流程
Phase 1: Information Gathering
阶段1:信息收集
Collect all information upfront so user doesn't need to answer questions five times:
=== Android Play Store Pipeline Setup ===
This will configure your complete Android deployment pipeline.
You'll be asked questions once, then everything will be set up automatically.
Time estimate: 15-20 minutes (mostly waiting for builds)
Press Enter to begin...Run through questionnaire, validate answers, confirm before proceeding.
一次性收集所有信息,避免用户重复回答五次问题:
=== Android Play Store 部署流水线设置 ===
该操作将配置你的完整Android部署流水线。
你只需回答一次问题,之后所有配置都会自动完成。
预计耗时:15-20分钟(主要等待构建过程)
按回车键开始...完成问卷填写,验证答案无误后再继续执行。
Phase 2: Release Build Setup
阶段2:发布构建设置
Execute android-release-build-setup skill:
=== Step 1/5: Release Build Configuration ===
Setting up keystores and signing...
✓ Generated production keystore
✓ Generated local dev keystore
✓ Configured ProGuard/R8
✓ Updated build.gradle.kts
✓ Updated .gitignore
✓ Created keystore documentation
Keystores created:
- keystores/production-release.jks (gitignored)
- keystores/local-dev-release.jks (gitignored)
- keystores/KEYSTORE_INFO.txt (gitignored, SAVE SECURELY!)
⏱ Time: 2 minutesOutputs:
- Production keystore for CI/CD
- Local dev keystore for testing
- ProGuard configuration
- Signing configuration in build.gradle.kts
- Keystore info file with passwords
执行android-release-build-setup Skill:
=== 步骤1/5:发布构建配置 ===
正在设置密钥库和签名...
✓ 生成生产环境密钥库
✓ 生成本地开发环境密钥库
✓ 配置ProGuard/R8
✓ 更新build.gradle.kts
✓ 更新.gitignore
✓ 创建密钥库说明文档
已创建的密钥库:
- keystores/production-release.jks(已加入git忽略)
- keystores/local-dev-release.jks(已加入git忽略)
- keystores/KEYSTORE_INFO.txt(已加入git忽略,请安全保存!)
⏱ 耗时:2分钟输出内容:
- 用于CI/CD的生产环境密钥库
- 用于测试的本地开发环境密钥库
- ProGuard配置
- build.gradle.kts中的签名配置
- 包含密码的密钥库信息文件
Phase 3: E2E Testing Setup
阶段3:E2E测试设置
Execute android-e2e-testing-setup skill:
=== Step 2/5: E2E Testing Setup ===
Setting up Espresso testing...
✓ Added Espresso dependencies
✓ Created test directory structure
✓ Generated BaseTest class
✓ Created smoke tests
✓ Created navigation tests
✓ Added test utilities
✓ Created GitHub Actions workflow
Tests created:
- ExampleInstrumentedTest (smoke test)
- MainActivityTest (navigation test)
- TestUtils (custom matchers)
- ScreenshotUtil (failure screenshots)
⏱ Time: 3 minutesOutputs:
- Espresso dependencies
- Test directory structure
- Sample tests
- Test utilities
- CI/CD test workflow
执行android-e2e-testing-setup Skill:
=== 步骤2/5:E2E测试设置 ===
正在设置Espresso测试...
✓ 添加Espresso依赖
✓ 创建测试目录结构
✓ 生成BaseTest基类
✓ 创建冒烟测试用例
✓ 创建导航测试用例
✓ 添加测试工具类
✓ 创建GitHub Actions工作流
已创建的测试用例:
- ExampleInstrumentedTest(冒烟测试)
- MainActivityTest(导航测试)
- TestUtils(自定义匹配器)
- ScreenshotUtil(失败截图工具)
⏱ 耗时:3分钟输出内容:
- Espresso依赖
- 测试目录结构
- 示例测试用例
- 测试工具类
- CI/CD测试工作流
Phase 4: Release Validation
阶段4:发布验证设置
Execute android-release-validation skill:
=== Step 3/5: Release Validation Setup ===
Setting up release validation...
✓ Created validation script
✓ Created validation workflow
✓ Configured quality gates
Validation configured:
- Build APK/AAB with ProGuard
- Run E2E tests on release
- Verify signing
- Check ProGuard mapping
- Analyze APK contents
⏱ Time: 2 minutesOutputs:
- Validation bash script
- GitHub Actions validation workflow
- Quality gate configuration
执行android-release-validation Skill:
=== 步骤3/5:发布验证设置 ===
正在设置发布验证...
✓ 创建验证脚本
✓ 创建验证工作流
✓ 配置质量门禁
已配置的验证内容:
- 使用ProGuard构建APK/AAB
- 在发布构建上运行E2E测试
- 验证签名
- 检查ProGuard映射文件
- 分析APK内容
⏱ 耗时:2分钟输出内容:
- 验证bash脚本
- GitHub Actions验证工作流
- 质量门禁配置
Phase 5: Play Console Setup
阶段5:Play Console设置
Execute android-playstore-setup skill:
=== Step 4/5: Play Console Integration ===
Setting up Play Console access...
✓ Created release notes structure
✓ Generated release notes templates
✓ Documented track types
✓ Created GitHub Secrets guide
✓ Generated validation script
Manual steps required:
1. Create service account in Google Cloud
2. Enable Play Developer API
3. Link to Play Console
4. Add SERVICE_ACCOUNT_JSON_PLAINTEXT to GitHub Secrets
See: distribution/PLAY_CONSOLE_SETUP.md for detailed guide
⏱ Time: 5 minutes (+ 10 minutes manual setup)Outputs:
- Release notes directory structure
- Track configuration docs
- GitHub Secrets documentation
- Play Console setup guide
- API validation script
Interactive Guide:
Optionally walk through service account creation if user wants to do it now.
执行android-playstore-setup Skill:
=== 步骤4/5:Play Console集成 ===
正在设置Play Console访问权限...
✓ 创建发布说明结构
✓ 生成发布说明模板
✓ 记录渠道类型说明
✓ 创建GitHub Secrets配置指南
✓ 生成验证脚本
需要手动完成的步骤:
1. 在Google Cloud中创建服务账号
2. 启用Play Developer API
3. 关联到Play Console
4. 将SERVICE_ACCOUNT_JSON_PLAINTEXT添加到GitHub Secrets
详细指南请查看:distribution/PLAY_CONSOLE_SETUP.md
⏱ 耗时:5分钟(+ 10分钟手动设置时间)输出内容:
- 发布说明目录结构
- 渠道配置文档
- GitHub Secrets说明文档
- Play Console设置指南
- API验证脚本
交互式引导:
如果用户希望立即完成,可选择跟随引导完成服务账号创建。
Phase 6: CI/CD Deployment
阶段6:CI/CD部署设置
Execute android-playstore-publishing skill:
=== Step 5/5: CI/CD Deployment Workflows ===
Creating deployment workflows...
✓ Created deploy-internal.yml
✓ Created deploy-beta.yml
✓ Created deploy-production.yml
✓ Created manage-rollout.yml
✓ Created workflow documentation
✓ Created version increment script
Workflows created:
- Internal: Auto-deploy on push to main
- Beta: Manual deploy to alpha/beta
- Production: Staged rollout with approval
- Rollout: Manage production rollout
⏱ Time: 3 minutesOutputs:
- Four GitHub Actions workflows
- Workflow documentation
- Version management script
执行android-playstore-publishing Skill:
=== 步骤5/5:CI/CD部署工作流 ===
正在创建部署工作流...
✓ 创建deploy-internal.yml
✓ 创建deploy-beta.yml
✓ 创建deploy-production.yml
✓ 创建manage-rollout.yml
✓ 创建工作流说明文档
✓ 创建版本号递增脚本
已创建的工作流:
- Internal:推送到main分支时自动部署
- Beta:手动部署到Alpha/Beta渠道
- Production:需要审批的分阶段发布
- Rollout:管理正式版发布进度
⏱ 耗时:3分钟输出内容:
- 4个GitHub Actions工作流
- 工作流说明文档
- 版本管理脚本
Phase 7: Final Configuration
阶段7:最终配置
=== Finalizing Setup ===
Running final checks...
✓ All files created
✓ Project structure validated
✓ Git repository ready
✓ Documentation generated
Generating summary...=== 完成最终设置 ===
正在运行最终检查...
✓ 所有文件已创建
✓ 项目结构已验证
✓ Git仓库已准备就绪
✓ 说明文档已生成
正在生成总结报告...Phase 8: Validate Complete Pipeline (MANDATORY)
阶段8:验证完整流水线(必须执行)
CRITICAL: This step is MANDATORY and must pass before completing the skill.
Validate the entire pipeline end-to-end:
bash
undefined重要提示:此步骤为必须执行项,必须通过后才能完成Skill操作。
端到端验证整个流水线:
bash
undefined1. REQUIRED: Verify all 5 prerequisite skills completed their criteria
1. 必须执行:验证所有5项前置Skill是否完成要求
echo "Checking Skill 1: Release Build Setup"
./gradlew assembleRelease && echo "✓ Release build works" || echo "✗ Skill 1 incomplete"
echo "Checking Skill 2: E2E Testing"
./gradlew connectedDebugAndroidTest && echo "✓ E2E tests work" || echo "✗ Skill 2 incomplete"
echo "Checking Skill 3: Release Validation"
./gradlew connectedReleaseAndroidTest && echo "✓ Release validation works" || echo "✗ Skill 3 incomplete"
echo "Checking Skill 4: Play Console Setup"
python3 scripts/validate-playstore.py <service-account.json> <package-name> && echo "✓ Play Console works" || echo "✗ Skill 4 incomplete"
echo "Checking Skill 5: Publishing Workflows"
yamllint .github/workflows/deploy-*.yml && echo "✓ Workflows valid" || echo "✗ Skill 5 incomplete"
echo "检查Skill 1:发布构建设置"
./gradlew assembleRelease && echo "✓ 发布构建正常" || echo "✗ Skill 1未完成"
echo "检查Skill 2:E2E测试"
./gradlew connectedDebugAndroidTest && echo "✓ E2E测试正常" || echo "✗ Skill 2未完成"
echo "检查Skill 3:发布验证"
./gradlew connectedReleaseAndroidTest && echo "✓ 发布验证正常" || echo "✗ Skill 3未完成"
echo "检查Skill 4:Play Console设置"
python3 scripts/validate-playstore.py <service-account.json> <package-name> && echo "✓ Play Console正常" || echo "✗ Skill 4未完成"
echo "检查Skill 5:发布工作流"
yamllint .github/workflows/deploy-*.yml && echo "✓ 工作流配置有效" || echo "✗ Skill 5未完成"
2. REQUIRED: Verify all required files exist
2. 必须执行:验证所有必要文件是否存在
[ -f "keystores/KEYSTORE_INFO.txt" ] || echo "✗ Missing keystore info"
[ -d "app/src/androidTest" ] || echo "✗ Missing tests"
[ -f ".github/workflows/deploy-internal.yml" ] || echo "✗ Missing workflows"
[ -f "distribution/GITHUB_SECRETS.md" ] || echo "✗ Missing secrets doc"
[ -f "keystores/KEYSTORE_INFO.txt" ] || echo "✗ 缺少密钥库信息文件"
[ -d "app/src/androidTest" ] || echo "✗ 缺少测试用例"
[ -f ".github/workflows/deploy-internal.yml" ] || echo "✗ 缺少工作流文件"
[ -f "distribution/GITHUB_SECRETS.md" ] || echo "✗ 缺少密钥配置文档"
3. REQUIRED: Check .gitignore includes keystores
3. 必须执行:检查.gitignore是否包含密钥库目录
grep -q "keystores/" .gitignore && echo "✓ Keystores gitignored" || echo "✗ Keystores not in .gitignore"
grep -q "keystores/" .gitignore && echo "✓ 密钥库已加入Git忽略" || echo "✗ 密钥库未加入Git忽略"
4. REQUIRED: Verify documentation exists
4. 必须执行:验证说明文档是否存在
[ -f "distribution/PLAY_CONSOLE_SETUP.md" ] || echo "⚠ Play Console setup guide missing"
[ -f ".github/workflows/README.md" ] || echo "✗ Workflow README missing"
**Expected output:**
- All 5 skills verified: ✓ Each skill's completion criteria met
- All files exist: ✓ No missing files
- .gitignore configured: ✓ Keystores excluded
- Documentation complete: ✓ All guides present
**If ANY fail:**
1. DO NOT complete pipeline skill
2. Go back to the failing skill
3. Complete that skill's criteria
4. Re-run pipeline validation
5. Only complete when ALL pass
**This is the orchestration skill - it MUST verify all prerequisites.**[ -f "distribution/PLAY_CONSOLE_SETUP.md" ] || echo "⚠ 缺少Play Console设置指南"
[ -f ".github/workflows/README.md" ] || echo "✗ 缺少工作流说明文档"
**预期输出:**
- 所有5项Skill验证通过:✓ 每项Skill均满足完成条件
- 所有文件存在:✓ 无缺失文件
- .gitignore配置正确:✓ 密钥库已被排除
- 说明文档完整:✓ 所有指南均已生成
**如果任何一项失败:**
1. 不要标记流水线Skill为完成
2. 返回失败的Skill步骤
3. 完成该Skill的要求
4. 重新运行流水线验证
5. 只有当所有项都通过后,才能标记为完成
**这是编排类Skill - 必须验证所有前置条件。**Phase 9: Comprehensive Summary
阶段9:完整总结报告
╔════════════════════════════════════════════════════════════════╗
║ 🎉 Android Play Store Pipeline Setup Complete! 🎉 ║
╚════════════════════════════════════════════════════════════════╝
⏱ Total Time: ~15 minutes
📦 What Was Created:
Release Build Configuration:
✓ Production keystore (CI/CD)
✓ Local dev keystore (testing)
✓ ProGuard/R8 configuration
✓ Signing setup in build.gradle.kts
E2E Testing:
✓ Espresso dependencies
✓ 3 sample test classes
✓ Test utilities and helpers
✓ CI/CD test workflow
Release Validation:
✓ Validation script
✓ Quality gate workflow
✓ E2E tests on release builds
Play Console:
✓ Release notes structure
✓ Track documentation
✓ GitHub Secrets guide
✓ Setup instructions
CI/CD Deployment:
✓ 4 deployment workflows
✓ Rollout management
✓ Version scripts
📋 Next Steps (in order):
⚠️ CRITICAL - Secure Your Keystores:
1. Open: keystores/KEYSTORE_INFO.txt
2. Copy passwords to password manager
3. Store file in secure location (NOT git!)
4. Back up keystores to secure location
5. NEVER commit keystores to git
🔐 Setup GitHub Secrets:
1. Go to: Repository → Settings → Secrets → Actions
2. Add SERVICE_ACCOUNT_JSON_PLAINTEXT (see guide below)
3. Add signing secrets:
- SIGNING_KEY_STORE_BASE64
- SIGNING_KEY_ALIAS
- SIGNING_STORE_PASSWORD
- SIGNING_KEY_PASSWORD
See: distribution/GITHUB_SECRETS.md for detailed instructions
🎮 Setup Play Console (10-15 minutes):
1. Create service account in Google Cloud
2. Enable Play Developer API
3. Link to Play Console
4. Grant permissions
5. Download JSON key
See: distribution/PLAY_CONSOLE_SETUP.md for step-by-step guide
🏗️ Setup GitHub Environment:
1. Go to: Repository → Settings → Environments
2. Create "production" environment
3. Add required reviewers
4. Save protection rules
✅ Test the Pipeline:
1. Update release notes: fastlane/metadata/android/en-US/changelogs/default.txt
2. Commit and push to main:
git add .
git commit -m "Add Play Store deployment pipeline"
git push origin main
3. Watch GitHub Actions deploy to internal track
4. Test on device via Play Console internal testing link
🚀 First Production Release:
1. Test thoroughly in internal track
2. Deploy to beta: Actions → Deploy to Beta
3. Collect feedback from beta testers
4. Tag for production:
git tag v1.0.0
git push origin v1.0.0
5. Approve in GitHub Actions
6. Monitor staged rollout
📂 Files Created:
Keystores (SECURE THESE!):
• keystores/production-release.jks
• keystores/local-dev-release.jks
• keystores/KEYSTORE_INFO.txt
Build Configuration:
• app/build.gradle.kts (updated)
• app/proguard-rules.pro
• gradle.properties.template
Tests:
• app/src/androidTest/.../ExampleInstrumentedTest.kt
• app/src/androidTest/.../base/BaseTest.kt
• app/src/androidTest/.../screens/MainActivityTest.kt
• app/src/androidTest/.../utils/TestUtils.kt
• app/src/androidTest/.../utils/ScreenshotUtil.kt
Release Notes:
• fastlane/metadata/android/en-US/changelogs/default.txt
• fastlane/metadata/android/README.md
• docs/PLAY_STORE_TRACKS.md
Documentation:
• PLAY_CONSOLE_SETUP.md (project root)
• GITHUB_SECRETS.md (if needed)
• .github/workflows/README.md
Workflows:
• .github/workflows/deploy-internal.yml
• .github/workflows/deploy-beta.yml
• .github/workflows/deploy-production.yml
• .github/workflows/manage-rollout.yml
• .github/workflows/android-test.yml
• .github/workflows/release-validation.yml
Scripts:
• scripts/validate-playstore.py
• scripts/increment-version.sh
• scripts/validate-release.sh
🔗 Important Links:
📖 Documentation:
- Play Console Setup: distribution/PLAY_CONSOLE_SETUP.md
- GitHub Secrets: distribution/GITHUB_SECRETS.md
- Workflow Usage: .github/workflows/README.md
- Release Tracks: distribution/TRACKS.md
🌐 External Resources:
- Play Console: https://play.google.com/console/
- Google Cloud: https://console.cloud.google.com/
- GitHub Actions: https://github.com/{org}/{repo}/actions
⚠️ Important Reminders:
Security:
⚠️ NEVER commit keystores to git
⚠️ Store keystore passwords securely
⚠️ Rotate service account keys annually
⚠️ Review Play Console audit logs
First Upload:
⚠️ First Play Store upload MUST be manual
⚠️ Create app in Play Console first
⚠️ Upload one APK/AAB manually
⚠️ Then automated uploads will work
Version Management:
⚠️ Version code must increase each upload
⚠️ Use scripts/increment-version.sh
⚠️ Keep mapping files for each release
Monitoring:
⚠️ Monitor crash-free rate (target: >99%)
⚠️ Use staged rollouts (start 5-10%)
⚠️ Review user feedback actively
⚠️ Be ready to halt rollout if needed
📊 Pipeline Overview:
Development → Push to main
↓
Internal Testing (automatic)
↓
Test on device, fix bugs
↓
Manual: Deploy to Beta Track
↓
Beta Testing (1-2 weeks)
↓
Collect feedback, fix
↓
Tag version: v1.0.0
↓
Production Deployment (requires approval)
↓
5% Rollout (monitor 24-48h)
↓
Increase to 20% (if stable)
↓
Increase to 50% (if stable)
↓
Complete to 100%
🎓 Learning Resources:
If you're new to any of these concepts:
- ProGuard/R8: See app/proguard-rules.pro comments
- Espresso Testing: See app/src/androidTest/README.md
- GitHub Actions: See .github/workflows/README.md
- Play Console: See distribution/PLAY_CONSOLE_SETUP.md
- Staged Rollouts: See distribution/TRACKS.md
💬 Need Help?
Common issues and solutions:
- "Build fails": Check signing secrets are correct
- "Tests fail": Review test logs in GitHub Actions
- "Upload fails": Verify service account permissions
- "Version error": Run scripts/increment-version.sh
Resources:
- GitHub Actions logs (detailed error messages)
- Play Console support (console help)
- Documentation in this repository
╔════════════════════════════════════════════════════════════════╗
║ Your Android deployment pipeline is ready! 🚀 ║
║ ║
║ Start with the "Next Steps" section above. ║
║ Questions? Check the documentation files created. ║
╚════════════════════════════════════════════════════════════════╝╔════════════════════════════════════════════════════════════════╗
║ 🎉 Android Play Store部署流水线设置完成! 🎉 ║
╚════════════════════════════════════════════════════════════════╝
⏱ 总耗时:约15分钟
📦 已完成的配置:
发布构建配置:
✓ 生产环境密钥库(用于CI/CD)
✓ 本地开发环境密钥库(用于测试)
✓ ProGuard/R8配置
✓ build.gradle.kts中的签名设置
E2E测试:
✓ Espresso依赖
✓ 3个示例测试类
✓ 测试工具与辅助类
✓ CI/CD测试工作流
发布验证:
✓ 验证脚本
✓ 质量门禁工作流
✓ 发布构建的E2E测试
Play Console集成:
✓ 发布说明结构
✓ 渠道说明文档
✓ GitHub Secrets配置指南
✓ 设置操作指南
CI/CD部署:
✓ 4个部署工作流
✓ 发布进度管理
✓ 版本管理脚本
📋 后续步骤(按顺序执行):
⚠️ 重要 - 保护你的密钥库:
1. 打开:keystores/KEYSTORE_INFO.txt
2. 将密码复制到密码管理器
3. 将文件存储在安全位置(不要提交到Git!)
4. 将密钥库备份到安全位置
5. 绝对不要将密钥库提交到Git
🔐 设置GitHub Secrets:
1. 访问:仓库 → 设置 → Secrets → Actions
2. 添加SERVICE_ACCOUNT_JSON_PLAINTEXT(请查看下方指南)
3. 添加签名密钥:
- SIGNING_KEY_STORE_BASE64
- SIGNING_KEY_ALIAS
- SIGNING_STORE_PASSWORD
- SIGNING_KEY_PASSWORD
详细说明请查看:distribution/GITHUB_SECRETS.md
🎮 设置Play Console(10-15分钟):
1. 在Google Cloud中创建服务账号
2. 启用Play Developer API
3. 关联到Play Console
4. 授予权限
5. 下载JSON密钥
分步指南请查看:distribution/PLAY_CONSOLE_SETUP.md
🏗️ 设置GitHub环境:
1. 访问:仓库 → 设置 → Environments
2. 创建「production」环境
3. 添加必要的审核人员
4. 保存保护规则
✅ 测试流水线:
1. 更新发布说明:fastlane/metadata/android/en-US/changelogs/default.txt
2. 提交并推送到main分支:
git add .
git commit -m "添加Play Store部署流水线"
git push origin main
3. 查看GitHub Actions自动部署到内部测试渠道
4. 通过Play Console内部测试链接在设备上测试
🚀 首次正式版发布:
1. 在内部测试渠道中充分测试
2. 部署到Beta渠道:Actions → Deploy to Beta
3. 收集Beta测试用户的反馈
4. 标记正式版版本:
git tag v1.0.0
git push origin v1.0.0
5. 在GitHub Actions中审批发布
6. 监控分阶段发布进度
📂 已创建的文件:
密钥库(请妥善保管!):
• keystores/production-release.jks
• keystores/local-dev-release.jks
• keystores/KEYSTORE_INFO.txt
构建配置:
• app/build.gradle.kts(已更新)
• app/proguard-rules.pro
• gradle.properties.template
测试用例:
• app/src/androidTest/.../ExampleInstrumentedTest.kt
• app/src/androidTest/.../base/BaseTest.kt
• app/src/androidTest/.../screens/MainActivityTest.kt
• app/src/androidTest/.../utils/TestUtils.kt
• app/src/androidTest/.../utils/ScreenshotUtil.kt
发布说明:
• fastlane/metadata/android/en-US/changelogs/default.txt
• fastlane/metadata/android/README.md
• docs/PLAY_STORE_TRACKS.md
说明文档:
• PLAY_CONSOLE_SETUP.md(项目根目录)
• GITHUB_SECRETS.md(如有需要)
• .github/workflows/README.md
工作流:
• .github/workflows/deploy-internal.yml
• .github/workflows/deploy-beta.yml
• .github/workflows/deploy-production.yml
• .github/workflows/manage-rollout.yml
• .github/workflows/android-test.yml
• .github/workflows/release-validation.yml
脚本:
• scripts/validate-playstore.py
• scripts/increment-version.sh
• scripts/validate-release.sh
🔗 重要链接:
📖 说明文档:
- Play Console设置:distribution/PLAY_CONSOLE_SETUP.md
- GitHub Secrets配置:distribution/GITHUB_SECRETS.md
- 工作流使用方法:.github/workflows/README.md
- 发布渠道说明:distribution/TRACKS.md
🌐 外部资源:
- Play Console: https://play.google.com/console/
- Google Cloud: https://console.cloud.google.com/
- GitHub Actions: https://github.com/{org}/{repo}/actions
⚠️ 重要提醒:
安全相关:
⚠️ 绝对不要将密钥库提交到Git
⚠️ 妥善保管密钥库密码
⚠️ 每年轮换服务账号密钥
⚠️ 定期查看Play Console审计日志
首次上传:
⚠️ 首次上传到Play Store必须手动完成
⚠️ 先在Play Console中创建应用
⚠️ 手动上传一个APK/AAB
⚠️ 之后才能使用自动化上传
版本管理:
⚠️ 每次上传必须递增版本号
⚠️ 使用scripts/increment-version.sh脚本
⚠️ 保存每个版本的映射文件
监控:
⚠️ 监控无崩溃率(目标:>99%)
⚠️ 使用分阶段发布(初始5-10%)
⚠️ 积极查看用户反馈
⚠️ 随时准备暂停发布
📊 流水线流程概览:
开发 → 推送到main分支
↓
内部测试(自动部署)
↓
在设备上测试,修复问题
↓
手动操作:部署到Beta渠道
↓
Beta测试(1-2周)
↓
收集反馈,修复问题
↓
标记版本:v1.0.0
↓
正式版发布(需要审批)
↓
5%用户覆盖(监控24-48小时)
↓
扩大到20%(如果稳定)
↓
扩大到50%(如果稳定)
↓
100%用户覆盖
🎓 学习资源:
如果你对以下概念不熟悉:
- ProGuard/R8: 查看app/proguard-rules.pro中的注释
- Espresso测试: 查看app/src/androidTest/README.md
- GitHub Actions: 查看.github/workflows/README.md
- Play Console: 查看distribution/PLAY_CONSOLE_SETUP.md
- 分阶段发布: 查看distribution/TRACKS.md
💬 需要帮助?
常见问题及解决方案:
- 「构建失败」: 检查签名密钥是否正确
- 「测试失败」: 查看GitHub Actions中的测试日志
- 「上传失败」: 验证服务账号权限
- 「版本错误」: 运行scripts/increment-version.sh脚本
资源:
- GitHub Actions日志(包含详细错误信息)
- Play Console支持(控制台内帮助)
- 本仓库中的说明文档
╔════════════════════════════════════════════════════════════════╗
║ 你的Android部署流水线已准备就绪! 🚀 ║
║ ║
║ 请从上方的「后续步骤」开始操作。 ║
║ 如有疑问,请查看已生成的说明文档。 ║
╚════════════════════════════════════════════════════════════════╝Error Handling
错误处理
Prerequisites Not Met
前置条件不满足
No Android project found:
❌ Error: Not an Android project
This directory doesn't appear to be an Android project.
Expected: app/build.gradle.kts or app/build.gradle
Solution: Run this skill from your Android project root directory.No package name in build.gradle:
❌ Error: Cannot determine package name
Could not find package name in app/build.gradle.kts
Solution: Add namespace or applicationId to your build file:
android {
namespace = "com.example.app"
}Git not initialized:
⚠️ Warning: Git repository not initialized
This is not a git repository. The pipeline works best with git.
Continue anyway? (y/n)未找到Android项目:
❌ 错误:不是Android项目
当前目录似乎不是Android项目。
预期文件:app/build.gradle.kts 或 app/build.gradle
解决方案:在Android项目的根目录运行该Skill。build.gradle中无包名:
❌ 错误:无法确定包名
在app/build.gradle.kts中未找到包名
解决方案:在构建文件中添加namespace或applicationId:
android {
namespace = "com.example.app"
}Git未初始化:
⚠️ 警告:Git仓库未初始化
当前目录不是Git仓库。流水线在Git环境下运行效果最佳。
是否继续?(y/n)Skill Execution Failures
Skill执行失败
Skill 1 fails (keystore generation):
❌ Error in Step 1/5: Release Build Setup
Failed to generate keystore.
Possible causes:
- keytool not found (JDK not installed)
- Insufficient permissions
- Directory doesn't exist
Fix: Install JDK 17 and try againSkill 2 fails (test setup):
❌ Error in Step 2/5: E2E Testing Setup
Failed to add Espresso dependencies.
Possible causes:
- build.gradle.kts has syntax errors
- File is read-only
Fix: Check build.gradle.kts is valid and writableRecovery:
- Pipeline stops at failed step
- Shows detailed error message
- User can fix issue and re-run
- Already completed steps are preserved (unless --clean flag used)
Skill 1失败(密钥库生成):
❌ 步骤1/5错误:发布构建设置
生成密钥库失败。
可能原因:
- 未找到keytool(未安装JDK)
- 权限不足
- 目录不存在
解决方案:安装JDK 17后重试Skill 2失败(测试设置):
❌ 步骤2/5错误:E2E测试设置
添加Espresso依赖失败。
可能原因:
- build.gradle.kts存在语法错误
- 文件为只读状态
解决方案:检查build.gradle.kts是否有效且可写入恢复方法:
- 流水线会在失败步骤停止
- 显示详细错误信息
- 用户可修复问题后重新运行
- 已完成的步骤会被保留(除非使用--clean参数)
User Cancellation
用户取消操作
Pipeline setup cancelled by user.
Completed steps:
✓ Step 1/5: Release Build Setup
✓ Step 2/5: E2E Testing Setup
✗ Step 3/5: Cancelled
To resume:
Run the skill again - completed steps will be detected
Or run individual skills:
- android-release-validation
- android-playstore-setup
- android-playstore-publishing流水线设置已被用户取消。
已完成的步骤:
✓ 步骤1/5:发布构建设置
✓ 步骤2/5:E2E测试设置
✗ 步骤3/5:已取消
恢复方法:
重新运行该Skill - 已完成的步骤会被自动检测
或单独运行剩余Skill:
- android-release-validation
- android-playstore-setup
- android-playstore-publishingAdvanced Options
高级选项
Selective Execution
选择性执行
Skip completed steps:
--resume Resume from last failed step
--skip=1,2 Skip steps 1 and 2 (already done)Clean slate:
--clean Remove all generated files and start freshDry run:
--dry-run Show what would be done without making changes跳过已完成的步骤:
--resume 从最后失败的步骤恢复
--skip=1,2 跳过步骤1和2(已完成)清理重置:
--clean 删除所有生成的文件,重新开始模拟运行:
--dry-run 显示将要执行的操作,但不实际修改文件Configuration File
配置文件
Save configuration for re-use:
.android-pipeline.ymlyaml
project:
package_name: com.example.app
app_name: MyApp
main_activity: MainActivity
organization:
name: Example Corp
unit: Engineering
city: San Francisco
state: California
country: US
testing:
locales:
- en-US
- de-DE
- es-ES
test_orchestrator: true
deployment:
tracks:
internal: true
beta: true
production: true
production_approval: trueUse saved config:
--config=.android-pipeline.yml保存配置以便重复使用:
.android-pipeline.ymlyaml
project:
package_name: com.example.app
app_name: MyApp
main_activity: MainActivity
organization:
name: Example Corp
unit: Engineering
city: San Francisco
state: California
country: US
testing:
locales:
- en-US
- de-DE
- es-ES
test_orchestrator: true
deployment:
tracks:
internal: true
beta: true
production: true
production_approval: true使用已保存的配置:
--config=.android-pipeline.ymlIntegration Test
集成测试
After pipeline setup, run integration test:
bash
undefined流水线设置完成后,运行集成测试:
bash
undefinedIntegration test script
集成测试脚本
./scripts/test-pipeline.sh
./scripts/test-pipeline.sh
Tests:
测试内容:
1. Build debug APK (should succeed)
1. 构建Debug APK(应成功)
2. Run unit tests (should pass)
2. 运行单元测试(应通过)
3. Build release APK (should succeed with ProGuard)
3. 构建Release APK(应使用ProGuard成功构建)
4. Verify ProGuard mapping exists
4. 验证ProGuard映射文件存在
5. Check signing configuration
5. 检查签名配置
6. Verify GitHub Actions workflows syntax
6. 验证GitHub Actions工作流语法
7. Validate release notes format
7. 验证发布说明格式
undefinedundefinedFiles Created/Modified
已创建/修改的文件
Created:
All files from Skills 1-5 plus:
- - Configuration (optional)
.android-pipeline.yml - - This complete guide
PIPELINE_SETUP.md - - Integration test
scripts/test-pipeline.sh
Modified:
- - Add keystore patterns
.gitignore - - Signing, ProGuard, test dependencies
app/build.gradle.kts - - Add deployment instructions (optional)
README.md
已创建:
包含所有5项Skill生成的文件,以及:
- - 配置文件(可选)
.android-pipeline.yml - - 本完整指南
PIPELINE_SETUP.md - - 集成测试脚本
scripts/test-pipeline.sh
已修改:
- - 添加密钥库忽略规则
.gitignore - - 签名、ProGuard、测试依赖配置
app/build.gradle.kts - - 添加部署说明(可选)
README.md
Completion Criteria (ALL MUST PASS)
完成条件(必须全部满足)
Do NOT mark this skill as complete unless ALL of the following are verified:
✅ All 5 prerequisite skills completed
- Skill 1 (android-release-build-setup) completion criteria met
- Skill 2 (android-e2e-testing-setup) completion criteria met
- Skill 3 (android-release-validation) completion criteria met
- Skill 4 (android-playstore-setup) completion criteria met
- Skill 5 (android-playstore-publishing) completion criteria met
✅ MANDATORY: End-to-end validation
- succeeds
./gradlew assembleRelease - succeeds
./gradlew connectedDebugAndroidTest - succeeds
./gradlew connectedReleaseAndroidTest - Play Console API connection validated
- All workflow YAML files valid
✅ Security checklist
- keystores/ in .gitignore
- KEYSTORE_INFO.txt never committed
- gradle.properties not committed (if contains secrets)
- Service account JSON not committed
✅ Documentation complete
- All prerequisite skills generated their documentation
- Pipeline-level README or guide exists
- Next steps clearly documented
If ANY checkbox is unchecked, the skill is NOT complete.
SPECIAL NOTE: This skill orchestrates all 5 others. If this skill's criteria pass, the user has a COMPLETE, production-ready Android Play Store deployment pipeline.
除非以下所有条件都已验证通过,否则不要标记该Skill为完成:
✅ 所有5项前置Skill已完成
- Skill 1 (android-release-build-setup) 满足完成条件
- Skill 2 (android-e2e-testing-setup) 满足完成条件
- Skill 3 (android-release-validation) 满足完成条件
- Skill 4 (android-playstore-setup) 满足完成条件
- Skill 5 (android-playstore-publishing) 满足完成条件
✅ 必须执行:端到端验证
- 执行成功
./gradlew assembleRelease - 执行成功
./gradlew connectedDebugAndroidTest - 执行成功
./gradlew connectedReleaseAndroidTest - Play Console API连接验证通过
- 所有工作流YAML文件有效
✅ 安全检查清单
- keystores/已加入.gitignore
- KEYSTORE_INFO.txt从未提交到Git
- gradle.properties未提交(如果包含敏感信息)
- 服务账号JSON文件未提交到Git
✅ 说明文档完整
- 所有前置Skill均已生成各自的说明文档
- 流水线级别的README或指南已存在
- 后续步骤已清晰记录
如果任何复选框未勾选,该Skill未完成。
特别说明: 该Skill编排了其他5项Skill。如果该Skill的条件全部满足,用户将拥有一套完整的、可用于生产环境的Android Play Store部署流水线。
Expected Outcomes
预期结果
After running this skill successfully:
✅ Complete deployment pipeline ready to use
✅ All 5 skills executed in correct order
✅ Security configured properly (keystores, secrets)
✅ Tests created and ready to extend
✅ CI/CD workflows ready for GitHub Actions
✅ Documentation comprehensive and clear
✅ Ready for first deployment after manual setup steps
成功运行该Skill后:
✅ 完整的部署流水线 已准备就绪
✅ 所有5项Skill 已按正确顺序执行
✅ 安全配置 已正确完成(密钥库、敏感信息)
✅ 测试用例 已创建并可扩展
✅ CI/CD工作流 已适配GitHub Actions
✅ 说明文档 全面且清晰
✅ 完成手动设置步骤后 即可进行首次部署
Next Skills (Dependencies)
依赖的Skill
This skill DEPENDS on ALL FIVE prerequisite skills:
- - REQUIRED
android-release-build-setup - - REQUIRED
android-e2e-testing-setup - - REQUIRED
android-release-validation - - REQUIRED
android-playstore-setup - - REQUIRED
android-playstore-publishing
This is the ORCHESTRATION skill. It runs all 5 in sequence and validates the complete pipeline.
Do NOT run this skill unless you want to set up the ENTIRE pipeline from scratch.
If you only need part of the pipeline, run individual skills instead.
This skill has NO downstream dependencies - it's the final step in the complete setup.
该Skill依赖以下全部5项前置Skill:
- - 必须
android-release-build-setup - - 必须
android-e2e-testing-setup - - 必须
android-release-validation - - 必须
android-playstore-setup - - 必须
android-playstore-publishing
这是一个编排类Skill。它会按顺序运行所有5项Skill,并验证完整流水线。
除非你想要从零开始搭建整套流水线,否则不要运行该Skill。
如果你只需要流水线的部分功能,请单独运行对应的Skill。
该Skill没有下游依赖 - 它是完整设置流程的最后一步。
Security Checklist
安全检查清单
Before first deployment:
- Keystore passwords stored in password manager
- Keystores backed up to secure location
- .gitignore includes keystore patterns
- GitHub Secrets added (all 5 required)
- Service account JSON stored securely (NOT in git)
- Production environment created with approvers
- Reviewed all generated files for sensitive data
首次部署前:
- 密钥库密码已存储在密码管理器中
- 密钥库已备份到安全位置
- .gitignore包含密钥库目录
- 已添加所有必要的GitHub Secrets(共5项)
- 服务账号JSON文件已安全存储(未提交到Git)
- 已创建带有审核人员的生产环境
- 已检查所有生成文件是否包含敏感数据
Troubleshooting
故障排除
"Pipeline setup incomplete"
「流水线设置未完成」
→ Check error messages for which step failed
→ Fix the issue and re-run with --resume
→ 查看错误信息,确定哪个步骤失败
→ 修复问题后使用--resume参数重新运行
"Keystores not secure"
「密钥库不安全」
→ Verify .gitignore includes keystore patterns
→ Check keystores/ directory not in git
→ 验证.gitignore是否包含密钥库目录
→ 检查keystores/目录是否未提交到Git
"GitHub Actions syntax error"
「GitHub Actions语法错误」
→ Validate YAML syntax online
→ Check package name replaced correctly
→ 在线验证YAML语法
→ 检查包名是否已正确替换
"First upload fails"
「首次上传失败」
→ Must upload APK/AAB manually to Play Console first
→ Create app in Play Console before automated uploads
→ 必须先手动将APK/AAB上传到Play Console
→ 先在Play Console中创建应用,再使用自动化上传
Best Practices
最佳实践
- Run in clean project first time
- Save configuration for future use
- Test locally before pushing to GitHub
- Read documentation generated
- Follow security checklist completely
- 首次使用时在干净的项目中运行
- 保存配置以便重复使用
- 推送到GitHub前先在本地测试
- 阅读已生成的说明文档
- 完整遵循安全检查清单
References
参考资料
- Individual skills documentation in skills/ directory
- GitHub Actions: https://docs.github.com/en/actions
- Play Console: https://support.google.com/googleplay/android-developer
- ProGuard: https://www.guardsquare.com/manual/home
- Espresso: https://developer.android.com/training/testing/espresso
- 各Skill的说明文档位于skills/目录
- GitHub Actions: https://docs.github.com/en/actions
- Play Console: https://support.google.com/googleplay/android-developer
- ProGuard: https://www.guardsquare.com/manual/home
- Espresso: https://developer.android.com/training/testing/espresso