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:
14
ota/README.md
Normal file
14
ota/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# OTA 文件夹
|
||||
|
||||
此目录存放 manifest 生成脚本。manifest.json 是 CI 构建时动态生成的产物,
|
||||
上传到 Gitea Release Assets,**不提交到仓库**。
|
||||
|
||||
## 文件
|
||||
|
||||
- `gen-manifest.sh` — 构建后运行,计算 APK SHA256 并生成 manifest.json
|
||||
|
||||
## 流程
|
||||
|
||||
```
|
||||
CI 构建 APK → ./ota/gen-manifest.sh → curl 上传 manifest.json 到 Release
|
||||
```
|
||||
37
ota/gen-manifest.sh
Normal file
37
ota/gen-manifest.sh
Normal 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"
|
||||
Reference in New Issue
Block a user