update visible + failproof action
Some checks failed
Build and Publish Release / Build Linux (release) Failing after 17s
Build and Publish Release / Build Windows (release) Failing after 25s
Build and Publish Release / Upload Assets to Release (release) Has been cancelled

This commit is contained in:
borderban 2026-05-04 19:00:37 +05:00
parent 9155d1e50a
commit b040f207c8
2 changed files with 18 additions and 7 deletions

View file

@ -66,6 +66,7 @@ jobs:
name: Upload Assets to Release
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
@ -75,6 +76,7 @@ jobs:
- name: Add files to Forgejo Release
uses: https://github.com/softprops/action-gh-release@v2
with:
fail_on_unmatched_files: false
files: |
artifacts/linux-build/factorio-mod-sync-linux
artifacts/windows-build/factorio-mod-sync-windows.exe

23
main.py
View file

@ -11,8 +11,7 @@ import threading
import subprocess
import re
# --- КОНФИГУРАЦИЯ ---
APP_VERSION = "v1.1.6" # Укажите здесь вашу текущую версию
APP_VERSION = "v1.1.6"
UPDATE_API_URL = "https://git.borderban.ru/api/v1/repos/BorderBan/client-py/releases/latest"
SERVER_URL = "https://server1.borderban.ru/mods/"
CONFIG_FILE = Path.home() / ".factorio_sync_config.json"
@ -48,6 +47,14 @@ def check_and_update(root):
except Exception:
pass
# Показываем окно сразу во время проверки
update_win = tk.Toplevel(root)
update_win.title("Обновление")
update_win.geometry("350x100")
update_label = tk.Label(update_win, text="Проверка наличия обновлений...")
update_label.pack(expand=True)
update_win.update()
try:
# Получаем данные о последнем релизе
response = requests.get(UPDATE_API_URL, timeout=5)
@ -57,6 +64,7 @@ def check_and_update(root):
# Проверяем, нужна ли загрузка
if not latest_version or latest_version == APP_VERSION:
update_win.destroy()
return
# Определяем имя нужного ассета в зависимости от ОС
@ -68,18 +76,17 @@ def check_and_update(root):
asset_name = "factorio-mod-sync-linux"
if not asset_name:
update_win.destroy()
return
download_url = next((asset.get("browser_download_url") for asset in release_data.get("assets", []) if asset.get("name") == asset_name), None)
if not download_url:
update_win.destroy()
return
# Показываем небольшое окно с прогрессом
update_win = tk.Toplevel(root)
update_win.title("Обновление")
update_win.geometry("350x100")
tk.Label(update_win, text=f"Обнаружена новая версия ({latest_version}).\nЗагрузка обновления...\nПожалуйста, подождите.").pack(expand=True)
# Обновляем текст на окне, если обновление найдено
update_label.config(text=f"Обнаружена новая версия ({latest_version}).\nЗагрузка обновления...\nПожалуйста, подождите.")
update_win.update()
new_exe_path = exe_path + ".new"
@ -88,6 +95,7 @@ def check_and_update(root):
with open(new_exe_path, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
update_win.update() # Обновляем окно, чтобы оно не "зависало" во время скачивания
if system == "linux":
os.chmod(new_exe_path, 0o755)
@ -102,6 +110,7 @@ def check_and_update(root):
except Exception as e:
print(f"Ошибка проверки или установки обновления: {e}")
update_win.destroy()
# При ошибке просто продолжаем обычный запуск
class SyncApp: