docs: 更新命令文档和发布脚本

- 更新 release-android.md: 明确前置条件和通用项目支持
- 更新 auto-commit.md: 添加中英文 commit 信息平台选择规则
- 更新 commit-push.md: 添加中英文 commit 信息平台选择规则
- 更新 sync-oc-push.md: 添加中英文 commit 信息平台选择规则
- 更新 release-android.mjs: 支持从 tags 自动推断项目名,不再硬编码 android 前缀
- 更新 AGENTS.md: 补充中文交流规则的注意事项
This commit is contained in:
2026-01-09 16:54:56 +08:00
parent 0e161b3088
commit dce31f9729
6 changed files with 292 additions and 115 deletions

View File

@@ -1,14 +1,20 @@
---
description: Build and release Android APK to Gitea
description: Build and release Android APK to Gitea (generic for any Android project)
---
# Android Release Command
Build Android APK and upload to Gitea Release.
Build Android APK and upload to Gitea Release for the current directory's Android project.
## Prerequisites Check
## Prerequisites
First, verify the environment:
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
@@ -17,40 +23,25 @@ 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 current version
grep -h 'versionName' app/build.gradle.kts android/app/build.gradle.kts 2>/dev/null | head -1
# Check existing tags
git tag -l '*android*' -l 'v*' | tail -5
# Check recent tags (script will use the latest tag)
git tag -l | tail -10
```
## Release Process
**If there are uncommitted changes:**
1. Increment version: update `versionCode` (+1) and `versionName` in `app/build.gradle.kts`
2. Commit the changes with a descriptive message
3. Create annotated git tag:
- Monorepo: `git tag -a android-{version} -m "Release notes"`
- Standalone: `git tag -a v{version} -m "Release notes"`
4. Push commit and tag: `git push && git push origin {tag}`
**If no uncommitted changes but tag doesn't exist:**
1. Create tag and push it
## Build and Upload
After tag is created and pushed, run:
After creating and pushing the tag, run:
```bash
node ~/.config/opencode/bin/release-android.mjs
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
- Upload to Gitea Release matching the tag pattern
## Error Handling