1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 04:19:00 +03:00

feat(deploy): lab-seeds sync, msmtp nginx-readable secret, hub downloads

Signed-off-by: Anton Afanasyeu <a.afanasieff@gmail.com>
This commit is contained in:
Anton Afanasyeu
2026-07-12 13:53:38 +02:00
parent 624c9d3d7e
commit 465efa8d98
16 changed files with 691 additions and 241 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/sh
# Publish hub download artifacts (Session Studio jar) to BE downloads mount.
# APK is served via OTA stable channel (/v0/ota/) — run ci-build-and-publish-ota.sh separately.
# Publish hub download artifacts (Session Studio jar + latest OTA .apk) to BE downloads mount.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=/dev/null
@@ -8,6 +7,7 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
load_cluster_env
DOWNLOADS_ROOT="${APP_ROOT:-/var/www/localhost/htdocs/apps/app/androidcast_project}/downloads"
OTA_ROOT="${APP_ROOT:-/var/www/localhost/htdocs/apps/app/androidcast_project}/ota-artifacts/v0/ota"
WS="${AC_WORKSPACE_ROOT:-/var/www/ac/workspace}"
STUDIO_JAR="${WS}/ac-session-studio/build/libs/ac-session-studio.jar"
@@ -18,8 +18,44 @@ if [ -f "$STUDIO_JAR" ]; then
log "installed Session Studio jar → ${DOWNLOADS_ROOT}/ac-session-studio.jar"
else
log "WARN: Session Studio jar not built at ${STUDIO_JAR}"
log " cd ac-session-studio && ./gradlew shadowJar (or installDist) on builder node"
fi
# Prefer staging channel APK; fall back to stable.
apk_src=""
for ch in staging stable; do
channel_json="${OTA_ROOT}/channel/${ch}.json"
[ -f "$channel_json" ] || continue
manifest_url="$(sed -n 's/.*"manifestUrl"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$channel_json" | head -1)"
[ -n "$manifest_url" ] || continue
manifest_path="${OTA_ROOT}/${manifest_url#*\/v0\/ota\/}"
[ -f "$manifest_path" ] || continue
browser_url="$(sed -n 's/.*"browserApkUrl"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$manifest_path" | head -1)"
if [ -n "$browser_url" ]; then
candidate="${OTA_ROOT}/${browser_url#*\/v0\/ota\/}"
if [ -f "$candidate" ]; then
apk_src="$candidate"
break
fi
fi
otapkg_url="$(sed -n 's/.*"apkUrl"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$manifest_path" | head -1)"
if [ -n "$otapkg_url" ]; then
candidate="${OTA_ROOT}/${otapkg_url#*\/v0\/ota\/}"
if [ -f "$candidate" ]; then
apk_src="$candidate"
break
fi
fi
done
if [ -n "$apk_src" ]; then
install -m 644 "$apk_src" "${DOWNLOADS_ROOT}/android_cast-latest.apk"
base="$(basename "$apk_src" .otapkg)"
base="$(basename "$base" .apk)"
install -m 644 "$apk_src" "${DOWNLOADS_ROOT}/${base}.apk"
log "installed APK → ${DOWNLOADS_ROOT}/android_cast-latest.apk (from ${apk_src})"
else
log "WARN: no OTA .apk/.otapkg found under ${OTA_ROOT}/channel/{staging,stable}.json"
fi
chown -R nginx:nginx "$DOWNLOADS_ROOT" 2>/dev/null || true
log "Hub downloads dir: ${DOWNLOADS_ROOT}"
log "URL: ${PUBLIC_ORIGIN:-https://apps.f0xx.org}/v0/downloads/ac-session-studio.jar"