|
55 | 55 | )
|
56 | 56 | exit(0)
|
57 | 57 |
|
| 58 | +# read the version from pyproject.toml |
| 59 | +with open("pyproject.toml") as f: |
| 60 | + pyproject = toml.load(f) |
| 61 | + version = pyproject["tool"]["poetry"]["version"] |
| 62 | + |
| 63 | +if "--push" in sys.argv: |
| 64 | + try: |
| 65 | + with open(".last_version") as f: |
| 66 | + last_version = f.read().strip() |
| 67 | + except FileNotFoundError: |
| 68 | + with open(".last_version", "w") as f: |
| 69 | + f.write(version) |
| 70 | + last_version = version |
| 71 | + |
| 72 | + if last_version == version: |
| 73 | + update_version = input( |
| 74 | + f"Do you want to update the version number ({version}) in pyproject.toml?" |
| 75 | + ) |
| 76 | + if update_version.lower() in ["y", "yes"]: |
| 77 | + new_version = input("Enter the new version number: ") |
| 78 | + subprocess.run( |
| 79 | + ["poetry", "version", new_version], capture_output=True, check=True |
| 80 | + ) |
| 81 | + console.out("Version updated, don't forget to commit the change.") |
| 82 | + version = new_version |
| 83 | + |
58 | 84 | res = subprocess.run("docker info", shell=True, capture_output=True)
|
59 | 85 | if res.returncode != 0:
|
60 | 86 | console.print(
|
@@ -246,6 +272,7 @@ def generate_table(status: dict) -> Table:
|
246 | 272 | for service in ym["services"]:
|
247 | 273 | status[service] = "[grey62]building...[/grey62]"
|
248 | 274 | lt.update(generate_table(status))
|
| 275 | + # to use a different wheel without editing Dockerfile use --build-arg wheel="wheelname" |
249 | 276 | command_list = [
|
250 | 277 | "docker",
|
251 | 278 | "compose",
|
@@ -278,10 +305,6 @@ def generate_table(status: dict) -> Table:
|
278 | 305 | )
|
279 | 306 | exit(1)
|
280 | 307 |
|
281 |
| -# read the version from pyproject.toml |
282 |
| -with open("pyproject.toml") as f: |
283 |
| - pyproject = toml.load(f) |
284 |
| - version = pyproject["tool"]["poetry"]["version"] |
285 | 308 |
|
286 | 309 | # Now if the --push flag was given, push the images to Docker Hub
|
287 | 310 | # For this next part to work you need to be logged in to a docker hub account or the
|
@@ -313,6 +336,8 @@ def generate_table(status: dict) -> Table:
|
313 | 336 | exit(1)
|
314 | 337 |
|
315 | 338 | console.print("Docker images pushed successfully", style="green")
|
| 339 | + with open(".last_version", "w") as f: |
| 340 | + f.write(version) |
316 | 341 |
|
317 | 342 |
|
318 | 343 | if "--restart" in sys.argv:
|
|
0 commit comments