Merge pull request #13 from FoamyGuy/release_updater
Some checks failed
GitHub Release Actions / validate-build (push) Has been cancelled

working on release updater
This commit is contained in:
foamyguy 2025-06-20 16:26:30 -05:00 committed by GitHub
commit d80e33d35b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 2 deletions

View file

@ -30,4 +30,4 @@ jobs:
- name: Build assets
shell: bash
run: |
python build.py
python release_updater.py

View file

@ -1,3 +1,4 @@
from datetime import datetime
import os
import time
import zipfile
@ -118,6 +119,9 @@ def create_font_specific_zip(font_path: Path, src_dir: Path, learn_projects_dir:
with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zf:
for file_path in temp_dir.rglob("*"):
if file_path.is_file():
modification_time = datetime(2000, 1, 1, 0, 0, 0)
modification_timestamp = modification_time.timestamp()
os.utime(file_path, (modification_timestamp, modification_timestamp))
arcname = file_path.relative_to(temp_dir)
zf.write(file_path, arcname)
@ -152,6 +156,10 @@ def main():
learn_projects_dir = root_dir / "learn-projects"
output_dir = root_dir / "dist"
# delete output dir if it exists
if output_dir.exists():
shutil.rmtree(output_dir)
# Create output directory
output_dir.mkdir(parents=True, exist_ok=True)

View file

@ -26,6 +26,10 @@ def get_file_sha256(file_path):
return "File not found."
return sha256_hash.hexdigest()
def print_hashes(hash_dict):
for filename in sorted(hash_dict.keys()):
print(f"{filename}: {hash_dict[filename]}")
def is_release_required():
"""
@ -64,10 +68,18 @@ def is_release_required():
for dist_file in Path("dist").iterdir():
dist_file_hashes[dist_file.name] = get_file_sha256(dist_file)
print("Downloaded file hashes:")
print_hashes(downloaded_file_hashes)
print("Dist file hashes:")
print_hashes(dist_file_hashes)
# compare hashes
if dist_file_hashes != downloaded_file_hashes:
print("Zip hashes differ, a release is required.")
return True
print("Zip hashes match, no release required.")
return False

0
src/__init__.py Normal file
View file