Skip to content

Commit

Permalink
parse version in docker-compile correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaSemple committed Aug 17, 2021
1 parent 4f78bed commit 2e9b6e4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docker/docker-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ else
fi

if [ -n "$VERSION" ]; then
SPLIT=(${VERSION//\./ })
PATCH="${SPLIT[2]}"
SPLIT=(${VERSION//[-+]/ })
FIRST_HALF=(${SPLIT[0]//\./ })

# determine major and minor versions
ENV="RSTUDIO_VERSION_MAJOR=${SPLIT[0]} RSTUDIO_VERSION_MINOR=${SPLIT[1]}"
ENV="RSTUDIO_VERSION_MAJOR=${FIRST_HALF[0]} RSTUDIO_VERSION_MINOR=${FIRST_HALF[1]} RSTUDIO_VERSION_PATCH=${FIRST_HALF[2]}"

# supply suffix if embedded in patch
if [[ $PATCH == *"-"* ]]; then
PATCH=(${PATCH//-/ })
ENV="$ENV RSTUDIO_VERSION_PATCH=${PATCH[0]} RSTUDIO_VERSION_SUFFIX=${PATCH[1]}"
if [[ ${#SPLIT[@]} -gt 2 ]]; then
ENV="$ENV RSTUDIO_VERSION_SUFFIX=-${SPLIT[1]}+${SPLIT[2]}"
else
ENV="$ENV RSTUDIO_VERSION_PATCH=$PATCH"
ENV="$ENV RSTUDIO_VERSION_SUFFIX=+${SPLIT[1]}"
fi
fi

Expand Down

0 comments on commit 2e9b6e4

Please sign in to comment.