aboutsummaryrefslogtreecommitdiff
path: root/publish/update_updatejson.py
blob: 8d751e5fc857b0073c3a4d98a1acccceee671a75 (plain)
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
import json
import subprocess

jsonPath = "../updatejson/update.json"

# lol
fullFormat = "updateJsonFullVersionFormat=true" in open("gradle.properties", "r", encoding="utf8").read()

data = json.load(open(jsonPath, "r", encoding="utf8"))
ver = open("version.txt", "r").read().strip()

for gameVer in json.load(open("gameVersions.json", "r")).keys():
    modVer = "{}".format(ver) if not fullFormat else "{}-{}".format(gameVer, ver)
    
    if gameVer not in data:
        data[gameVer] = {}
    
    data[gameVer][modVer] = ""
    data["promos"]["{}-latest".format(gameVer)] = modVer

json.dump(data, open(jsonPath, "w", encoding="utf8"), indent=2)

subprocess.run(["git", "add", jsonPath])
subprocess.run(["git", "commit", "-m", "[skip ci] Update update json"])
subprocess.run(["git", "push"])