Skip to content

Commit 09cd745

Browse files
committed
feat: implement version bumping in manifest.json after episode extraction
1 parent 0fd16ab commit 09cd745

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

scripts/update-episodes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
EXPORT_URL = f"https://docs.google.com/spreadsheets/d/{SPREADSHEET_ID}/export?format=xlsx"
1313
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
1414
OUTPUT_PATH = os.path.join(SCRIPT_DIR, "..", "data", "episodes.json")
15+
MANIFEST_PATH = os.path.join(SCRIPT_DIR, "..", "manifest.json")
1516

1617

1718
def download_spreadsheet():
@@ -107,6 +108,26 @@ def parse_episodes(xlsx_path):
107108
return arc_overview, all_episodes
108109

109110

111+
def bump_patch_version():
112+
"""Read manifest.json, bump the minor version (X.X.0 -> X.(X+1).0), write back."""
113+
with open(MANIFEST_PATH, "r", encoding="utf-8") as f:
114+
manifest = json.load(f)
115+
116+
version = manifest.get("version", "1.0.0")
117+
parts = version.split(".")
118+
if len(parts) == 3:
119+
parts[1] = str(int(parts[1]) + 1)
120+
parts[2] = "0"
121+
manifest["version"] = ".".join(parts)
122+
else:
123+
manifest["version"] = "1.0.0"
124+
125+
with open(MANIFEST_PATH, "w", encoding="utf-8") as f:
126+
json.dump(manifest, f, indent=2, ensure_ascii=False)
127+
128+
print(f"Version bumped to {manifest['version']}")
129+
130+
110131
def main():
111132
xlsx_path = None
112133
try:
@@ -125,6 +146,8 @@ def main():
125146
print(f"Extracted {len(episodes)} episodes across {len(arcs)} arcs")
126147
print(f"Written to {OUTPUT_PATH}")
127148

149+
bump_patch_version()
150+
128151
except Exception as e:
129152
print(f"Error: {e}", file=sys.stderr)
130153
sys.exit(1)

0 commit comments

Comments
 (0)