From 44c2ebcb432e063cffb5fc5b89c93e059dcc1a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Fri, 17 Nov 2023 08:22:25 +0100 Subject: [PATCH] check_version chore: define git_status variable --- deploy/chores/check_version | 10 ++++++++-- deploy/chores/docker_buildx | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/deploy/chores/check_version b/deploy/chores/check_version index e0f60d1..817039d 100755 --- a/deploy/chores/check_version +++ b/deploy/chores/check_version @@ -3,14 +3,20 @@ script="$( readlink -f "${0}" )" script_dir="$( dirname "${script}" )" -if [ "$( git rev-parse --abbrev-ref HEAD )" = "develop" ]; then +[ "$( git rev-parse --abbrev-ref HEAD )" = "develop" ] \ + && git_status="developing" +git rev-parse --abbrev-ref HEAD | grep -E 'release|hotfix/' >/dev/null \ + && git_status="releasing" + + +if [ "${git_status}" = "developing" ]; then echo "Status: Developing" # => version from most recent tag git_version="$( \ git describe --tags --abbrev=0 \ | sed -E 's/^v[^0-9]*((0|[1-9][0-9]*)[0-9\.]*[0-9]).*$/\1/' )" -elif git rev-parse --abbrev-ref HEAD | grep -E 'release|hotfix/' >/dev/null; then +elif [ "${git_status}" = "releasing" ]; then echo "Status: Releasing" # => version from releasing branch git_version="$( \ diff --git a/deploy/chores/docker_buildx b/deploy/chores/docker_buildx index 2f37620..f5ade1a 100755 --- a/deploy/chores/docker_buildx +++ b/deploy/chores/docker_buildx @@ -6,12 +6,19 @@ script_dir="$( dirname "${script}" )" # shellcheck disable=SC1091 . "${script_dir}/check_version" -# defined in `check_version` script +# vars defined in `check_version` script # shellcheck disable=SC2154 -echo "${git_version}" >/dev/null +if [ "${git_status}" = "releasing" ]; then + # shellcheck disable=SC2154 + image_tag="${git_version}" +else + image_tag="latest" +fi + +echo "Building Tag '${image_tag}'" docker buildx build \ --pull --push \ - --tag "code.yavook.de/oekzident.de/ovdashboard:${git_version}" \ + --tag "code.yavook.de/oekzident.de/ovdashboard:${image_tag}" \ --platform "linux/amd64,linux/arm64" \ "${script_dir}/../.."