chore: Update create-theme workflow to handle preferences file

This commit is contained in:
Mauro Balades 2024-08-16 01:10:57 +02:00
parent 34c19e2524
commit 57d355020d
2 changed files with 13 additions and 7 deletions

View file

@ -150,13 +150,18 @@ Just joking, you can do whatever you want. You're the boss.
with open(f"themes/{theme_id}/{README_FILE}", 'w') as f:
f.write(get_readme())
with open(f"themes/{theme_id}/{PREFERENCES_FILE}", 'w') as f:
prefs = get_preferences()
if len(prefs) > 0:
print("Detected preferences file. Please review the preferences below.")
print(prefs)
theme['preferences'] = get_static_asset(theme_id, PREFERENCES_FILE)
json.dump(prefs, f)
if os.path.exists(TEMPLATE_PREFERENCES_FILE):
prefs_file = f"themes/{theme_id}/{PREFERENCES_FILE}"
with open(prefs_file, 'w') as f:
prefs = get_preferences()
if len(prefs) > 0:
print("Detected preferences file. Please review the preferences below.")
print(prefs)
theme['preferences'] = get_static_asset(theme_id, PREFERENCES_FILE)
json.dump(prefs, f)
else:
print("No preferences detected.")
os.remove(prefs_file)
download_image(image, f"themes/{theme_id}/{IMAGE_FILE}")