Files
opencode/command/release-android.md

1.4 KiB

description
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_API_TOKEN environment variable is set
  3. Ensure Android project exists in current directory

Check the environment:

# Check GITEA_API_TOKEN
echo "GITEA_API_TOKEN: ${GITEA_API_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:

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_API_TOKEN is not set: export GITEA_API_TOKEN="your_token"
  • If build fails: check Java/Android SDK installation
  • If tag not found: create and push the tag first

$ARGUMENTS