check_version chore: define git_status variable

This commit is contained in:
Jörn-Michael Miehe 2023-11-17 08:22:25 +01:00
parent ed0a671d9c
commit 44c2ebcb43
2 changed files with 18 additions and 5 deletions

View file

@ -3,14 +3,20 @@
script="$( readlink -f "${0}" )" script="$( readlink -f "${0}" )"
script_dir="$( dirname "${script}" )" 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" echo "Status: Developing"
# => version from most recent tag # => version from most recent tag
git_version="$( \ git_version="$( \
git describe --tags --abbrev=0 \ git describe --tags --abbrev=0 \
| sed -E 's/^v[^0-9]*((0|[1-9][0-9]*)[0-9\.]*[0-9]).*$/\1/' | 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" echo "Status: Releasing"
# => version from releasing branch # => version from releasing branch
git_version="$( \ git_version="$( \

View file

@ -6,12 +6,19 @@ script_dir="$( dirname "${script}" )"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. "${script_dir}/check_version" . "${script_dir}/check_version"
# defined in `check_version` script # vars defined in `check_version` script
# shellcheck disable=SC2154 # 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 \ docker buildx build \
--pull --push \ --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" \ --platform "linux/amd64,linux/arm64" \
"${script_dir}/../.." "${script_dir}/../.."