diff --git a/scripts/deploy.py b/scripts/deploy.py index 5cfb65e..81d22ce 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -2,14 +2,24 @@ import os import time import getpass +try: + import toml + +except ImportError: + print( + "You need to install `toml` to use this file. Run `pip install toml` and try again." + ) + sys.exit() + username = input("Username for git.nyeki.dev: ") password = getpass.getpass("Password for git.nyeki.dev: ") -latest_tag = input("Latest tag (empty for latest): ") or "latest" - -print(f"Updating to tag {latest_tag}...") - os.system(f"git pull https://{username}:{password}@git.nyeki.dev/payphone/payphone") + +data = toml.load(open("pyproject.toml")) +version = data["project"]["version"].split(".") +latest_tag = "v" + version[1] + os.system( f"microk8s kubectl set image sts/bot bot=registry.nyeki.dev/payphone/payphone/shard:{latest_tag}" )