Files
payphone/scripts/update.py
T

38 lines
928 B
Python

import os
import sys
try:
import toml
except ImportError:
print(
"You need to install `toml` to use this file. Run `pip install toml` and try again."
)
sys.exit()
data = toml.load(open("pyproject.toml"))
version = data["project"]["version"].split(".")
version[1] = str(int(version[1]) + 1)
data["project"]["version"] = ".".join(version)
version_num = version[1]
targets = ["tasks", "shard"]
for t in targets:
tag = f"registry.nyeki.dev/payphone/payphone/{t}:v{version_num}"
os.system(f"docker build --target {t} --tag {tag} .")
os.system(f"docker push {tag}")
tag = f"registry.nyeki.dev/payphone/payphone/{t}:latest"
os.system(f"docker build --target {t} --tag {tag} .")
os.system(f"docker push {tag}")
toml.dump(data, open("pyproject.toml", "w"))
os.system("git add pyproject.toml uv.lock")
os.system("git commit -m 'chore: 🔖 Bump version.'")
os.system("git push")