From 1b3d8994dfbfb12aac981ca00ee7e7d65ede8c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Tue, 12 May 2026 01:44:52 +0900 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE?= =?UTF-8?q?=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8E=20OTA=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D0=B8=20=D0=B8=D0=B7=20pubspec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/ota_publish.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/ota_publish.py b/backend/ota_publish.py index 8d89ec6..577842b 100644 --- a/backend/ota_publish.py +++ b/backend/ota_publish.py @@ -7,6 +7,7 @@ import paramiko from backend.android_tools import find_apks from backend.projects_registry import find_project_by_workspace +from backend.pubspec_tools import read_pubspec_version from backend.runtime_logs import add_log @@ -14,6 +15,17 @@ def _safe_name(value: str) -> str: return value.strip().replace('/', '-').replace(' ', '-').lower() +def _apply_pubspec_version(settings: dict, workspace: str) -> dict: + synced = dict(settings) + pubspec = read_pubspec_version(workspace) + + if pubspec: + synced['version'] = pubspec.get('version') or synced.get('version') + synced['build'] = pubspec.get('build') or synced.get('build') + + return synced + + def _latest_json(settings: dict) -> dict: notes_raw = settings.get('notes') or '' notes = [line.strip() for line in notes_raw.splitlines() if line.strip()] @@ -53,7 +65,7 @@ def publish_project_ota(workspace: str) -> dict: if not project: return {'success': False, 'message': 'Project not found in registry'} - settings = project.get('ota') or {} + settings = _apply_pubspec_version(project.get('ota') or {}, workspace) if not settings.get('enabled'): return {'success': False, 'message': 'OTA publish disabled'} @@ -82,6 +94,7 @@ def publish_project_ota(workspace: str) -> dict: apk_path = apks[0] add_log(f'OTA publish started: {project.get("name")} -> {host}:{remote_path}') + add_log(f'OTA version synced from pubspec: {version}+{build}') transport = paramiko.Transport((host, int(settings.get('sftp_port') or 22))) try: