Skip to content

Commit

Permalink
Fix version numbering deploy script (#1275)
Browse files Browse the repository at this point in the history
* Fix version numbering issue

* Alternative approach to pass linting

* Fix linting errors
  • Loading branch information
tunetheweb authored and sudheendrachari committed Sep 15, 2020
1 parent 0ff8ae7 commit 69d0fdc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/tools/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ echo "Please test the site locally"

check_continue "Are you ready to deploy?"

LAST_TAGGED_VERSION=$(git tag -l "v*" | tail)
LAST_TAGGED_VERSION=$(git tag -l "v*" | tail -1)
echo "Last tagged version: ${LAST_TAGGED_VERSION}"
if [[ "${LAST_TAGGED_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
SEMVER=( "${LAST_TAGGED_VERSION//./ }" )
#Split LAST_TAGGED_VERSION on dots (.) into SEMVER
IFS=\. read -r -a SEMVER <<<"${LAST_TAGGED_VERSION}"
MAJOR="${SEMVER[0]}"
MINOR="${SEMVER[1]}"
PATCH="${SEMVER[2]}"
NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH"
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
else
echo -e "${AMBER}Warning - last tagged version is not of the format vX.X.X!${RESET_COLOR}"
fi
Expand All @@ -70,9 +71,13 @@ while [[ ! "${TAG_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
do
echo "Please update major tag version when changing default year"
echo "Please update minor tag version when adding new languages or other large changes"
read -r -p "Please select tag version of the format vX.X.X. [$NEXT_VERSION]: " TAG_VERSION
read -r -p "Please select tag version of the format vX.X.X. [${NEXT_VERSION}]: " TAG_VERSION
if [[ -z "${TAG_VERSION}" ]]; then
TAG_VERSION="${NEXT_VERSION}"
fi
done
echo "Tagging as ${TAG_VERSION}"
check_continue "Tag as ${TAG_VERSION}?"

LONG_DATE=$(date -u +%Y-%m-%d\ %H:%M:%S)
git tag -a "${TAG_VERSION}" -m "Version ${TAG_VERSION} ${LONG_DATE}"
echo "Tagged ${TAG_VERSION} with message 'Version ${TAG_VERSION} ${LONG_DATE}'"
Expand Down

0 comments on commit 69d0fdc

Please sign in to comment.