Добавил автосинхронизацию OTA версии из pubspec

Этот коммит содержится в:
Виктор
2026-05-12 01:44:52 +09:00
родитель 90e97ce542
Коммит 1b3d8994df
+14 -1
Просмотреть файл
@@ -7,6 +7,7 @@ import paramiko
from backend.android_tools import find_apks from backend.android_tools import find_apks
from backend.projects_registry import find_project_by_workspace from backend.projects_registry import find_project_by_workspace
from backend.pubspec_tools import read_pubspec_version
from backend.runtime_logs import add_log from backend.runtime_logs import add_log
@@ -14,6 +15,17 @@ def _safe_name(value: str) -> str:
return value.strip().replace('/', '-').replace(' ', '-').lower() 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: def _latest_json(settings: dict) -> dict:
notes_raw = settings.get('notes') or '' notes_raw = settings.get('notes') or ''
notes = [line.strip() for line in notes_raw.splitlines() if line.strip()] 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: if not project:
return {'success': False, 'message': 'Project not found in registry'} 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'): if not settings.get('enabled'):
return {'success': False, 'message': 'OTA publish disabled'} return {'success': False, 'message': 'OTA publish disabled'}
@@ -82,6 +94,7 @@ def publish_project_ota(workspace: str) -> dict:
apk_path = apks[0] apk_path = apks[0]
add_log(f'OTA publish started: {project.get("name")} -> {host}:{remote_path}') 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))) transport = paramiko.Transport((host, int(settings.get('sftp_port') or 22)))
try: try: