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

23
main.py
View file

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