feat(scripts): ✨ Make deploy.py read latest version from pyproject.toml.
This commit is contained in:
+14
-4
@@ -2,14 +2,24 @@ import os
|
|||||||
import time
|
import time
|
||||||
import getpass
|
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: ")
|
username = input("Username for git.nyeki.dev: ")
|
||||||
password = getpass.getpass("Password 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")
|
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(
|
os.system(
|
||||||
f"microk8s kubectl set image sts/bot bot=registry.nyeki.dev/payphone/payphone/shard:{latest_tag}"
|
f"microk8s kubectl set image sts/bot bot=registry.nyeki.dev/payphone/payphone/shard:{latest_tag}"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user