From f5e42ee93dad8e0905974f98bf272e58d3004645 Mon Sep 17 00:00:00 2001 From: Rob Peters Date: Thu, 3 Feb 2022 09:56:37 +0100 Subject: [PATCH] Dynamic version tags --- Dockerfile | 1 + build.sh | 16 +++++++++++++--- buildstable.sh | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 456d143..c13bc82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,7 @@ RUN set -ex \ VOLUME /opt/domoticz/userdata EXPOSE 8080 +EXPOSE 6144 EXPOSE 443 ENV LOG_PATH= diff --git a/build.sh b/build.sh index 00832e6..337769c 100644 --- a/build.sh +++ b/build.sh @@ -10,11 +10,21 @@ then echo "Error downloading version file!"; exit 1 fi +curl -ksL https://releases.domoticz.com/releases/beta/history_linux_x86_64.txt --output history.h +if [ $? -ne 0 ] +then + echo "Error downloading version file!"; + exit 1 +fi declare $(cat version.h | awk '{print $2"="$3}') RELEASE_DATE="$(date -d @$APPDATE -u +"%Y-%m-%dT%H:%M:%SZ")" -BETA_VERSION=2022 -echo "Building release $BETA_VERSION.$APPVERSION from commit $APPHASH ($RELEASE_DATE)"; + +VERSION_TAG_RAW=$(cat history.h | head -1 | awk '{print $2}') +IFS='.' read -r -a array <<< "$VERSION_TAG_RAW" +VERSION_TAG="${array[0]}" + +echo "Building release $VERSION_TAG.$APPVERSION from commit $APPHASH ($RELEASE_DATE)"; # Remove double quotes in APPHASH APPHASH="${APPHASH%\"}" @@ -25,4 +35,4 @@ docker buildx rm domoticz_build >/dev/null 2>&1 || true docker buildx create --name domoticz_build docker buildx use domoticz_build docker buildx inspect --bootstrap -echo "docker buildx build --push --no-cache --platform ${BUILDX_PLATFORMS} --build-arg APP_VERSION=$APPVERSION --build-arg APP_HASH=$APPHASH --build-arg BUILD_DATE=$RELEASE_DATE --tag domoticz/domoticz:latest --tag domoticz/domoticz:beta --tag domoticz/domoticz:$BETA_VERSION-beta.$APPVERSION ." +echo "docker buildx build --push --no-cache --platform ${BUILDX_PLATFORMS} --build-arg APP_VERSION=$APPVERSION --build-arg APP_HASH=$APPHASH --build-arg BUILD_DATE=$RELEASE_DATE --tag domoticz/domoticz:latest --tag domoticz/domoticz:beta --tag domoticz/domoticz:$VERSION_TAG-beta.$APPVERSION ." diff --git a/buildstable.sh b/buildstable.sh index cb0b310..d33629b 100644 --- a/buildstable.sh +++ b/buildstable.sh @@ -10,11 +10,21 @@ then echo "Error downloading version file!"; exit 1 fi +curl -ksL https://releases.domoticz.com/releases/release/history_linux_x86_64.txt --output history.h +if [ $? -ne 0 ] +then + echo "Error downloading version file!"; + exit 1 +fi declare $(cat version.h | awk '{print $2"="$3}') RELEASE_DATE="$(date -d @$APPDATE -u +"%Y-%m-%dT%H:%M:%SZ")" -STABLE_VERSION=2022.1 -echo "Building release $STABLE_VERSION.$APPVERSION from commit $APPHASH ($RELEASE_DATE)"; + +VERSION_TAG_RAW=$(cat history.h | head -1 | awk '{print $2}') +IFS='.' read -r -a array <<< "$VERSION_TAG_RAW" +VERSION_TAG="${array[0]}.${array[1]}" + +echo "Building release $VERSION_TAG.$APPVERSION from commit $APPHASH ($RELEASE_DATE)"; # Remove double quotes in APPHASH APPHASH="${APPHASH%\"}" @@ -25,4 +35,4 @@ docker buildx rm domoticz_build >/dev/null 2>&1 || true docker buildx create --name domoticz_build docker buildx use domoticz_build docker buildx inspect --bootstrap -echo "docker buildx build --push --no-cache --platform ${BUILDX_PLATFORMS} --build-arg APP_VERSION=$APPVERSION --build-arg APP_HASH=$APPHASH --build-arg BUILD_DATE=$RELEASE_DATE --build-arg STABLE=true --tag domoticz/domoticz:stable --tag domoticz/domoticz:$STABLE_VERSION ." +echo "docker buildx build --push --no-cache --platform ${BUILDX_PLATFORMS} --build-arg APP_VERSION=$APPVERSION --build-arg APP_HASH=$APPHASH --build-arg BUILD_DATE=$RELEASE_DATE --build-arg STABLE=true --tag domoticz/domoticz:stable --tag domoticz/domoticz:$VERSION_TAG ."