62 lines
1.6 KiB
Markdown
62 lines
1.6 KiB
Markdown
---
|
|
description: Build and release Android APK to Gitea
|
|
---
|
|
|
|
# Android Release Command
|
|
|
|
Build Android APK and upload to Gitea Release.
|
|
|
|
## Prerequisites Check
|
|
|
|
First, verify 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 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
|
|
```
|
|
|
|
## 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:
|
|
|
|
```bash
|
|
node ~/.config/opencode/bin/release-android.mjs
|
|
```
|
|
|
|
The script will:
|
|
- Auto-detect Android project root (standalone or monorepo)
|
|
- Auto-detect Gitea config from git remote URL (HTTPS/SSH)
|
|
- Auto-detect Java from Android Studio
|
|
- Build release APK
|
|
- Upload to Gitea Release
|
|
|
|
## 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
|