1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 02:59:00 +03:00

Add gzip-aware crash upload and OTA staging build/deploy tooling.

This restores the interrupted stash work on a dedicated feature branch, including backend decoding support, Dockerized build scripts, and staging channel artifacts for end-to-end OTA validation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-06-02 16:08:46 +02:00
parent 9f9d617730
commit 097c0790b8
18 changed files with 258 additions and 11 deletions

32
scripts/deploy-ota-staging.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Rsync ./out/ota/v0 to a remote web root (staging OTA tree).
#
# Usage:
# OTA_DEPLOY_TARGET=foxx@10.7.16.128:/var/www/localhost/htdocs/ \
# ./scripts/deploy-ota-staging.sh
#
# Dry run:
# OTA_DEPLOY_DRY_RUN=1 ./scripts/deploy-ota-staging.sh
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRC="${ROOT}/out/ota/v0"
TARGET="${OTA_DEPLOY_TARGET:?Set OTA_DEPLOY_TARGET=user@host:/path/to/web/root}"
if [[ ! -d "$SRC" ]]; then
echo "Missing ${SRC} — run ./scripts/docker-build-ota.sh first" >&2
exit 1
fi
RSYNC_OPTS=(-av --delete)
if [[ "${OTA_DEPLOY_DRY_RUN:-}" == "1" ]]; then
RSYNC_OPTS+=(--dry-run -v)
fi
echo "Sync ${SRC}/ -> ${TARGET}/v0/"
rsync "${RSYNC_OPTS[@]}" "${SRC}/" "${TARGET%/}/v0/"
echo "Channel pointer (after deploy):"
if [[ -f "${ROOT}/out/BUILD_INFO.json" ]]; then
grep channelUrl "${ROOT}/out/BUILD_INFO.json" || true
fi

39
scripts/docker-build-ota.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Host wrapper: build androidcast-ci image and run build + OTA staging publish.
#
# Usage:
# export OTA_BASE_URL=https://apps.f0xx.org
# ./scripts/docker-build-ota.sh
#
# Artifacts: ./out/android_cast-latest.apk ./out/ota/v0/ota/...
#
# Deploy to BE (example — adjust host/path):
# rsync -av ./out/ota/v0/ user@be:/var/www/localhost/htdocs/v0/
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMAGE="${ANDROIDCAST_CI_IMAGE:-androidcast-ci:latest}"
docker build -t "$IMAGE" -f "${ROOT}/Dockerfile" "${ROOT}"
mkdir -p "${ROOT}/out"
docker run --rm \
-v "${ROOT}:/workspace" \
-w /workspace \
-e OTA_BASE_URL="${OTA_BASE_URL:-}" \
-e OTA_CHANNEL="${OTA_CHANNEL:-staging}" \
-e GRADLE_TASK="${GRADLE_TASK:-assembleDebug}" \
-e SKIP_NATIVE="${SKIP_NATIVE:-0}" \
-e SKIP_TESTS="${SKIP_TESTS:-0}" \
-e RELEASE_NOTES="${RELEASE_NOTES:-}" \
-e OUT_DIR=/workspace/out \
"$IMAGE" \
./scripts/ci-build-and-publish-ota.sh
echo ""
echo "Done. APK: ${ROOT}/out/android_cast-latest.apk"
if [[ -f "${ROOT}/out/BUILD_INFO.json" ]]; then
echo "OTA channel URL:"
sed -n 's/.*"channelUrl": "\([^"]*\)".*/\1/p' "${ROOT}/out/BUILD_INFO.json" | head -1
fi

View File

@@ -4,9 +4,12 @@
# Usage:
# ./scripts/generate-ota-v0.sh path/to/app-release.apk https://host[:port] [out-dir] [channel]
#
# channel — JSON file under v0/ota/channel/ (default: stable). Use staging for QA.
# RELEASE_NOTES — optional env, embedded in manifest.
#
# channel — JSON under v0/ota/channel/ (stable, staging, dev, nightly, or custom)
# Writes under out-dir (default: ./ota-publish):
# v0/ota/channel/stable.json
# v0/ota/channel/<channel>.json
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB_manifest.json
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB_sign.json
# v0/ota/00/00.MM/00.MM.mm/android_cast_00.MM.mm.BB.otapkg
@@ -17,6 +20,19 @@ apk="${1:?APK path required}"
host_base="${2:?Base URL required, e.g. https://192.168.1.1:8080}"
out_dir="${3:-ota-publish}"
channel="${4:-stable}"
release_notes="${RELEASE_NOTES:-}"
json_notes() {
if command -v jq >/dev/null 2>&1; then
jq -n --arg n "$release_notes" '$n'
else
local esc="${release_notes//\\/\\\\}"
esc="${esc//\"/\\\"}"
esc="${esc//$'\n'/\\n}"
esc="${esc//$'\r'/}"
printf '"%s"' "$esc"
fi
}
NOTES_JSON="$(json_notes)"
if [[ ! -f "$apk" ]]; then
echo "APK not found: $apk" >&2
@@ -84,7 +100,7 @@ cat >"${rel_dir}/${manifest_name}" <<EOF
"signUrl": "${sign_url}",
"sizeBytes": ${apk_size},
"mandatory": false,
"releaseNotes": ""
"releaseNotes": ${NOTES_JSON}
}
EOF
@@ -113,7 +129,7 @@ cat >"${rel_dir}/${manifest_name}" <<EOF
"bundleSha256": "${bundle_sha256}",
"bundleSizeBytes": ${bundle_size},
"mandatory": false,
"releaseNotes": ""
"releaseNotes": ${NOTES_JSON}
}
EOF