Build/auto bump website version (#5280)

Also of note is that for enterprise builds we can set CONSUL_NO_WEBSITE_UPDATE to prevent updating the version twice.

Lastly we also do not update the website version for pre-releases like rc1.

This just streamlines a release build a bit.
This commit is contained in:
Matt Keeler 2019-01-28 14:51:49 -05:00 committed by GitHub
parent b72a4aa464
commit 6f17e05ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 0 deletions

View File

@ -673,6 +673,34 @@ function set_changelog_version {
return $?
}
function set_website_version {
# Arguments:
# $1 - Path to top level Consul source
# $2 - Version to put into the website
#
# Returns:
# 0 - success
# * - error
local config_rb="${1}/website/config.rb"
local version="$2"
if ! test -f "${config_rb}"
then
err "ERROR: File not found: '${config_rb}'"
return 1
fi
if test -z "${version}"
then
err "ERROR: Must specify a version to put into ${config_rb}"
return 1
fi
sed_i ${SED_EXT} -e "s/(h.version[[:space:]]*=[[:space:]]*)\"[^\"]*\"/\1\"${version}\"/g" "${config_rb}"
return $?
}
function unset_changelog_version {
# Arguments:
# $1 - Path to top level Consul source
@ -775,6 +803,17 @@ function set_release_mode {
return 1
fi
# Only update the website when allowed and there is no pre-release version
if ! is_set "${CONSUL_NO_WEBSITE_UPDATE}" && test -z "$4"
then
status_stage "==> Updating website/config.rb"
if ! set_website_version "${sdir}" "${vers}"
then
unset_changelog_version "${sdir}"
return 1
fi
fi
return 0
}