Files
opencode/command/release-android.md
voson dce31f9729 docs: 更新命令文档和发布脚本
- 更新 release-android.md: 明确前置条件和通用项目支持
- 更新 auto-commit.md: 添加中英文 commit 信息平台选择规则
- 更新 commit-push.md: 添加中英文 commit 信息平台选择规则
- 更新 sync-oc-push.md: 添加中英文 commit 信息平台选择规则
- 更新 release-android.mjs: 支持从 tags 自动推断项目名,不再硬编码 android 前缀
- 更新 AGENTS.md: 补充中文交流规则的注意事项
2026-01-09 16:54:56 +08:00

53 lines
1.4 KiB
Markdown

---
description: Build and release Android APK to Gitea (generic for any Android project)
---
# Android Release Command
Build Android APK and upload to Gitea Release for the current directory's Android project.
## Prerequisites
Before running this command:
1. **Create and push the git tag first** (e.g., `myapp-1.0.0`, `android-1.0.0`, or `v1.0.0`)
2. Ensure `GITEA_TOKEN` environment variable is set
3. Ensure Android project exists in current directory
Check the environment:
```bash
# Check GITEA_TOKEN
echo "GITEA_TOKEN: ${GITEA_TOKEN:+SET}"
# Check current directory for Android project
ls -la app/build.gradle.kts 2>/dev/null || ls -la android/app/build.gradle.kts 2>/dev/null || echo "No Android project found"
# Check recent tags (script will use the latest tag)
git tag -l | tail -10
```
## Build and Upload
After creating and pushing the tag, run:
```bash
node ~/.opencode/bin/release-android.mjs
```
The script will:
- Auto-detect Android project root (standalone or monorepo)
- Auto-detect project name from recent git tags or directory name
- Auto-detect Gitea config from git remote URL (HTTPS/SSH)
- Auto-detect Java from Android Studio
- Build release APK
- Upload to Gitea Release matching the tag pattern
## Error Handling
- If `GITEA_TOKEN` is not set: `export GITEA_TOKEN="your_token"`
- If build fails: check Java/Android SDK installation
- If tag not found: create and push the tag first
$ARGUMENTS