diff --git a/pyproject.toml b/pyproject.toml index 38dc137..7658e8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,11 @@ [project] name = "payphone" -version = "0.1.0" +version = "0.9.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.12" -dependencies = [ - "aerich==0.7.1", - "aiohttp>=3.10.10", - "click>=8.1.7", - "colorthief>=0.2.1", - "httpx>=0.27.2", - "orjson>=3.10.7", - "py-cord>=2.6.1", - "python-dotenv>=1.0.1", - "redis[hiredis]>=5.1.1", - "rich>=13.9.3", - "tortoise-orm[asyncpg]>=0.21.7", -] +dependencies = [ "aerich==0.7.1", "aiohttp>=3.10.10", "click>=8.1.7", "colorthief>=0.2.1", "httpx>=0.27.2", "orjson>=3.10.7", "py-cord>=2.6.1", "python-dotenv>=1.0.1", "redis[hiredis]>=5.1.1", "rich>=13.9.3", "tortoise-orm[asyncpg]>=0.21.7",] -[tool] [tool.aerich] tortoise_orm = "payphone.core.config.TORTOISE_ORM" location = "./payphone/db/migrations" diff --git a/scripts/deploy.py b/scripts/deploy.py new file mode 100644 index 0000000..136bbf8 --- /dev/null +++ b/scripts/deploy.py @@ -0,0 +1,22 @@ +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() + +version = toml.load(open("pyproject.toml"))["project"]["version"].split(".")[1] + +os.system("git pull") +os.system(f"kubectl set image sts/bot bot=git.nyeki.dev/payphone/payphone-shard:v{version}") +os.system(f""" +kubectl set image deploy/tasks \ + flush=git.nyeki.dev/payphone/payphone-shard:v{version} \ + delete-accounts=git.nyeki.dev/payphone/payphone-shard:v{version} \ + hangup-inactive-calls=git.nyeki.dev/payphone/payphone-shard:v{version} +""") diff --git a/scripts/update.py b/scripts/update.py new file mode 100644 index 0000000..6362056 --- /dev/null +++ b/scripts/update.py @@ -0,0 +1,33 @@ +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"git.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"git.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")) diff --git a/uv.lock b/uv.lock index a614cef..a090f36 100644 --- a/uv.lock +++ b/uv.lock @@ -387,7 +387,7 @@ wheels = [ [[package]] name = "payphone" -version = "0.1.0" +version = "0.9.0" source = { virtual = "." } dependencies = [ { name = "aerich" },