-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion_bump.py
More file actions
31 lines (24 loc) · 1.08 KB
/
version_bump.py
File metadata and controls
31 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import json
def main():
# Prompt for version string
version = input("Enter version string: ").strip()
# Loop through all directories in the current working directory
for entry in os.listdir("."):
if os.path.isdir(entry) and entry.startswith("com.jifish."):
manifest_path = os.path.join(entry, "manifest.json")
if os.path.isfile(manifest_path):
try:
# Read manifest.json
with open(manifest_path, "r", encoding="utf-8") as f:
data = json.load(f)
# Update version
data["Version"] = version
# Write back manifest.json
with open(manifest_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=4, ensure_ascii=False)
print(f"Updated {manifest_path} to version {version}")
except (json.JSONDecodeError, OSError) as e:
print(f"Failed to update {manifest_path}: {e}")
if __name__ == "__main__":
main()