| name | apkgo-cli-usage |
| description | Reference for configuring apkgo.yaml, writing before/after upload hooks (protocol + stdin JSON schemas), and the typical init/dry-run/upload workflow for the apkgo CLI. Use when setting up store credentials, writing or debugging a hook script, or walking an agent through uploading an APK end-to-end. |
Configuration
YAML file (apkgo.yaml) or environment variables (APKGO_<STORE>_<KEY>):
stores:
huawei:
service_account: ""
service_account_file: ""
client_id: ""
client_secret: ""
app_id: ""
xiaomi:
email: ""
private_key: ""
cert: ""
cert_file: ""
oppo:
client_id: ""
client_secret: ""
vivo:
access_key: ""
access_secret: ""
honor:
client_id: ""
client_secret: ""
app_id: ""
meizu:
client_id: ""
client_secret: ""
tencent:
user_id: ""
access_secret: ""
app_id: ""
app_id_map: ""
package_name: ""
script:
command: "./deploy.sh"
script.cdn-upload:
command: "./upload-cdn.sh"
script.dingtalk:
command: "./notify-dingtalk.sh"
Env var example: APKGO_HUAWEI_SERVICE_ACCOUNT=$(base64 -w0 huawei-sa.json) apkgo upload -f app.apk --store huawei
Hooks
Shell commands executed before/after uploads. Receive context as JSON on stdin.
Configuration
hooks:
before: "./scripts/before-all.sh"
after: "./scripts/after-all.sh"
stores:
huawei:
client_id: "..."
before: "./scripts/before-huawei.sh"
after: "./scripts/after-huawei.sh"
Protocol
Exit codes:
0 — success (continue)
- non-zero — failure (
before hooks abort the upload; after hooks log warning only)
Environment variables (set automatically):
APKGO_STORE — store name (empty for global hooks)
APKGO_PACKAGE — package name (e.g. com.example.app)
APKGO_VERSION — version name (e.g. 1.2.0)
Errors: stderr is captured as the error message.
Stdin JSON schemas
Global before (hooks.before):
{
"file_path": "/path/to/app.apk",
"apk": {"package": "com.example.app", "version_name": "1.0.0", "version_code": 1, "app_name": "MyApp"},
"stores": ["huawei", "xiaomi"]
}
Global after (hooks.after):
{
"file_path": "/path/to/app.apk",
"apk": {"package": "com.example.app", "version_name": "1.0.0", "version_code": 1, "app_name": "MyApp"},
"results": [
{"store": "huawei", "success": true, "duration_ms": 12300},
{"store": "xiaomi", "success": false, "error": "auth failed", "duration_ms": 400}
]
}
Per-store before (stores.<name>.before):
{
"file_path": "/path/to/app.apk",
"apk": {"package": "com.example.app", "version_name": "1.0.0", "version_code": 1, "app_name": "MyApp"},
"store": "huawei"
}
Per-store after (stores.<name>.after):
{
"file_path": "/path/to/app.apk",
"apk": {"package": "com.example.app", "version_name": "1.0.0", "version_code": 1, "app_name": "MyApp"},
"store": "huawei",
"result": {"store": "huawei", "success": true, "duration_ms": 12300}
}
Typical agent workflow
which apkgo
apkgo init --store huawei,xiaomi -c apkgo.yaml
apkgo stores
apkgo upload -f app.apk --dry-run
apkgo upload -f app.apk --notes "v1.0.0 release" --timeout 15m