Generate commit hash and timestamp for CDN (#415)

This commit is contained in:
Ken Van Hoeylandt 2025-11-14 00:23:25 +01:00 committed by GitHub
parent c1ff024657
commit dddca1ea76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -1,10 +1,12 @@
import subprocess
from datetime import datetime, UTC
import os
import sys
import configparser
from dataclasses import dataclass, asdict
import json
import shutil
from configparser import ConfigParser, RawConfigParser
from configparser import RawConfigParser
VERBOSE = False
DEVICES_FOLDER = "Devices"
@ -39,6 +41,8 @@ class ManifestBuildPart:
@dataclass
class DeviceIndex:
version: str
created: str
gitCommit: str
devices: list
if sys.platform == "win32":
@ -174,6 +178,10 @@ def process_device(in_path: str, out_path: str, device_directory: str, device_id
with open(json_manifest_path, 'w') as json_manifest_file:
json.dump(asdict(manifest), json_manifest_file, indent=2)
def get_git_commit_hash():
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
def main(in_path: str, out_path: str, version: str):
if not os.path.exists(in_path):
exit_with_error(f"Input path not found: {in_path}")
@ -181,7 +189,12 @@ def main(in_path: str, out_path: str, version: str):
shutil.rmtree(out_path)
os.mkdir(out_path)
device_directories = os.listdir(in_path)
device_index = DeviceIndex(version, [])
device_index = DeviceIndex(
version=version,
created=datetime.now(UTC).strftime('%Y-%m-%dT%H:%M:%S'),
gitCommit=get_git_commit_hash(),
devices=[]
)
for device_directory in device_directories:
if device_directory.endswith("-symbols"):
continue

View File

@ -6,7 +6,6 @@
- Add low memory warning when calling DevelopmentService::handleAppInstall()
- Add low memory warning when calling tt::app::install
- Add statusbar icon that shows low/critical memory warnings
- CDN upload should mention upload timestamp (at least for snapshot builds)
- Change ButtonControl to work with interrupts and xQueue
- TCA9534 keyboards should use interrupts
- GT911 drivers should use interrupts if it's stable