build(bot): 🔨 Add updating and deployment scripts.

This commit is contained in:
Nyeki.py
2024-11-03 13:32:45 -03:00
parent edb8ad65c7
commit 2f33d9610c
4 changed files with 58 additions and 16 deletions
+2 -15
View File
@@ -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"
+22
View File
@@ -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}
""")
+33
View File
@@ -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"))
Generated
+1 -1
View File
@@ -387,7 +387,7 @@ wheels = [
[[package]]
name = "payphone"
version = "0.1.0"
version = "0.9.0"
source = { virtual = "." }
dependencies = [
{ name = "aerich" },