Initialize API
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
import toml
|
||||
|
||||
def get_release_version():
|
||||
"""
|
||||
Reads the version from the Cargo.toml file.
|
||||
"""
|
||||
|
||||
cargo_toml_path = os.path.join(os.path.dirname(__file__), 'Cargo.toml')
|
||||
|
||||
with open(cargo_toml_path, 'r') as f:
|
||||
cargo_toml = toml.load(f)
|
||||
|
||||
return cargo_toml['package']['version']
|
||||
|
||||
version = get_release_version()
|
||||
|
||||
input(f"The current version is v{version}. Is this properly bumped? (Enter/Ctrl+C)")
|
||||
|
||||
script = f"""
|
||||
docker build -t registry.nyeki.dev/nyeki/api:latest .
|
||||
docker push registry.nyeki.dev/nyeki/api:latest
|
||||
docker tag registry.nyeki.dev/nyeki/api:latest registry.nyeki.dev/nyeki/api:v{version}
|
||||
docker push registry.nyeki.dev/nyeki/api:v{version}
|
||||
|
||||
git add .
|
||||
git commit -m "Release {version} version"
|
||||
git tag -a v{version} -m "Release version {version}"
|
||||
git push origin main
|
||||
git push origin v{version}
|
||||
"""
|
||||
|
||||
os.system(script)
|
||||
|
||||
print(f"v{version} was released. Congratulations!")
|
||||
Reference in New Issue
Block a user