From f3fe2770173f01d6e4e7e55141afefcfd9c14d47 Mon Sep 17 00:00:00 2001 From: Kevin Restaino Date: Mon, 8 Jan 2024 16:47:53 -0500 Subject: [PATCH] feat: log version --- VERSION | 2 +- build_and_push.sh | 19 +++++++++++++++++++ sptnr.py | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 build_and_push.sh diff --git a/VERSION b/VERSION index 1cc5f65..8cfbc90 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.0 \ No newline at end of file +1.1.1 \ No newline at end of file diff --git a/build_and_push.sh b/build_and_push.sh new file mode 100755 index 0000000..a1b0d0a --- /dev/null +++ b/build_and_push.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Ensure the script stops if there is an error +set -e + +# Read version from the VERSION file +VERSION=$(cat VERSION) + +# Build the Docker image with the version tag +docker build -t krestaino/sptnr:$VERSION . + +# Tag the built image as latest +docker tag krestaino/sptnr:$VERSION krestaino/sptnr:latest + +# Push both tags to the Docker registry +docker push krestaino/sptnr:$VERSION +docker push krestaino/sptnr:latest + +echo "Docker images tagged and pushed: $VERSION and latest" diff --git a/sptnr.py b/sptnr.py index 3055aa2..cabbd15 100644 --- a/sptnr.py +++ b/sptnr.py @@ -143,6 +143,11 @@ parser.add_argument( help="limit to processing [NUM] artists from the start index", ) +parser.add_argument( + "-v", "--version", action="version", version=f"%(prog)s {__version__}" +) + + args = parser.parse_args() ARTIST_IDs = args.artist if args.artist else [] @@ -150,6 +155,8 @@ ALBUM_IDs = args.album if args.album else [] START = args.start LIMIT = args.limit +logging.info(f"{BOLD}Version:{RESET} {LIGHT_YELLOW}sptnr v{__version__}{RESET}") + if args.preview: logging.info(f"{LIGHT_YELLOW}Preview mode, no changes will be made.{RESET}") PREVIEW = 1