feat: ota/gen-manifest.sh — CI构建时动态生成manifest.json

- gen-manifest.sh: 计算APK SHA256 → 填入版本号/URL → 生成manifest.json
- manifest.json本身不提交仓库(构建产物,上传到Release)
- README.md说明目录用途
This commit is contained in:
LukeMackin
2026-07-19 19:28:58 +08:00
parent 31a56708d6
commit c1849802b6
2 changed files with 51 additions and 0 deletions

37
ota/gen-manifest.sh Normal file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# OTA manifest 生成脚本
# CI 构建时运行: ./ota/gen-manifest.sh <versionName> <versionCode> <apk-path>
# 生成 manifest.json 后上传到 Gitea Release
VERSION_NAME="${1:-0.1.0}"
VERSION_CODE="${2:-7}"
APK_PATH="${3:-packages/client-android/android/app/build/outputs/apk/debug/v0.1.0-dav-android-7-debug.apk}"
RELEASE_TAG="v${VERSION_NAME}-dav-android-${VERSION_CODE}"
APK_NAME="v${VERSION_NAME}-dav-android-${VERSION_CODE}-debug.apk"
SHA256=$(sha256sum "$APK_PATH" | cut -d' ' -f1)
SIZE=$(stat -c%s "$APK_PATH")
cat > ota/manifest.json <<JSON
{
"version": "${VERSION_NAME}",
"builds": {
"android": {
"type": "apk",
"tag": "${RELEASE_TAG}",
"url": "https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/releases/download/${RELEASE_TAG}/${APK_NAME}",
"sha256": "${SHA256}",
"size": ${SIZE},
"channel": "stable",
"minVersion": "${VERSION_NAME}"
}
}
}
JSON
echo "Generated: ota/manifest.json"
echo " tag: ${RELEASE_TAG}"
echo " sha256: ${SHA256}"
echo " size: ${SIZE}"
echo ""
echo "Upload: curl -X POST 'https://git.childish-ghost.com/api/v1/repos/LukeMackin/Yuzu-GCA/releases/\${RELEASE_ID}/assets?name=manifest.json' -H 'Authorization: token \$TOKEN' -H 'Content-Type: application/json' --data-binary @ota/manifest.json"