mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-10 08:38:33 +01:00
Compare commits
4 Commits
v1.0.2
...
94aaf97a4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94aaf97a4d | ||
|
|
3579948407 | ||
|
|
597a471949 | ||
|
|
27d32e147b |
11
.github/workflows/release.yaml
vendored
11
.github/workflows/release.yaml
vendored
@@ -25,7 +25,13 @@ jobs:
|
|||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
- name: Build EXE
|
- name: Build EXE
|
||||||
run: pyinstaller -F client.py
|
run: pyinstaller client.py
|
||||||
|
|
||||||
|
- name: Copy helper scripts
|
||||||
|
run: |
|
||||||
|
cp .\dist\run.bat .\dist\client\
|
||||||
|
cp .\dist\run.ps1 .\dist\client\
|
||||||
|
cp .\windows_run_as_admin.ps1 .\dist\client\
|
||||||
|
|
||||||
- name: Archive EXE
|
- name: Archive EXE
|
||||||
run: Compress-Archive -Path dist\ -DestinationPath release.zip
|
run: Compress-Archive -Path dist\ -DestinationPath release.zip
|
||||||
@@ -33,4 +39,5 @@ jobs:
|
|||||||
- name: Release
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: gh release create ${{ github.ref_name }} "release.zip" --generate-notes --title "release-${{ github.ref_name }}"
|
run: gh release create ${{ github.ref_name }} "release.zip" --generate-notes --title "release-${{ github.ref_name }}"
|
||||||
|
|
||||||
|
|||||||
31
check_release.py
Normal file
31
check_release.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import requests
|
||||||
|
import os
|
||||||
|
|
||||||
|
REPO = "FAUSheppy/homelab_gamevault"
|
||||||
|
API_URL = f"https://api.github.com/repos/{REPO}/releases/latest"
|
||||||
|
VERSION_FILE = ".gamevault_version"
|
||||||
|
|
||||||
|
def get_latest_release():
|
||||||
|
response = requests.get(API_URL)
|
||||||
|
response.raise_for_status()
|
||||||
|
data = response.json()
|
||||||
|
version = data['tag_name']
|
||||||
|
zip_url = data['zipball_url']
|
||||||
|
return version, zip_url
|
||||||
|
|
||||||
|
|
||||||
|
def read_local_version():
|
||||||
|
if not os.path.exists(VERSION_FILE):
|
||||||
|
return None
|
||||||
|
with open(VERSION_FILE, 'r') as f:
|
||||||
|
return f.read().strip()
|
||||||
|
|
||||||
|
def update_updater():
|
||||||
|
pass # TODO
|
||||||
|
# download updater
|
||||||
|
# replace updater
|
||||||
|
|
||||||
|
def execute_updater(new_version):
|
||||||
|
# TODO
|
||||||
|
# os.system(["updater.exe", new_version])
|
||||||
|
pass
|
||||||
@@ -320,6 +320,8 @@ def update_button_positions(event=None):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
# run updater #
|
||||||
|
|
||||||
pgw = pgwrapper.ProgressBarWrapper()
|
pgw = pgwrapper.ProgressBarWrapper()
|
||||||
pgw.new(app)
|
pgw.new(app)
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ tqdm
|
|||||||
Jinja2
|
Jinja2
|
||||||
pyyaml
|
pyyaml
|
||||||
pywin32==306; platform_system=="Windows"
|
pywin32==306; platform_system=="Windows"
|
||||||
requests
|
requests
|
||||||
|
sqlalchemy
|
||||||
2
updater/requirements.txt
Normal file
2
updater/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
tkinter
|
||||||
|
requests
|
||||||
51
updater/updater.py
Normal file
51
updater/updater.py
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import zipfile
|
||||||
|
import io
|
||||||
|
import shutil
|
||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
|
||||||
|
CLIENT_DIR = os.path.join("client")
|
||||||
|
INTERNAL_DIR = os.path.join(CLIENT_DIR, "_internal")
|
||||||
|
|
||||||
|
def prompt_user(version):
|
||||||
|
root = tk.Tk()
|
||||||
|
root.withdraw() # Hide main window
|
||||||
|
result = tk.messagebox.askyesno("Update Available", f"New version {version} available. Download and install?")
|
||||||
|
root.destroy()
|
||||||
|
return result
|
||||||
|
|
||||||
|
def download_and_extract(zip_url):
|
||||||
|
print("Downloading...")
|
||||||
|
response = requests.get(zip_url)
|
||||||
|
response.raise_for_status()
|
||||||
|
with zipfile.ZipFile(io.BytesIO(response.content)) as z:
|
||||||
|
temp_dir = "_temp_extracted"
|
||||||
|
z.extractall(temp_dir)
|
||||||
|
top_folder = next(os.scandir(temp_dir)).path
|
||||||
|
|
||||||
|
# Replace _internal
|
||||||
|
source_internal = os.path.join(top_folder, "client", "_internal")
|
||||||
|
if os.path.exists(INTERNAL_DIR):
|
||||||
|
shutil.rmtree(INTERNAL_DIR)
|
||||||
|
shutil.copytree(source_internal, INTERNAL_DIR)
|
||||||
|
|
||||||
|
# Replace client.exe
|
||||||
|
source_exe = os.path.join(top_folder, "client", "client.exe")
|
||||||
|
target_exe = os.path.join(CLIENT_DIR, "client.exe")
|
||||||
|
shutil.copy2(source_exe, target_exe)
|
||||||
|
|
||||||
|
shutil.rmtree(temp_dir)
|
||||||
|
print("Update complete.")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_user():
|
||||||
|
download_and_extract()
|
||||||
|
# TODO: run main file again
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user