2016-12-24 20:41:30 +00:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
2020-10-21 11:54:24 +00:00
|
|
|
# Bumps the version number to ${1}.
|
2016-12-24 20:41:30 +00:00
|
|
|
#
|
|
|
|
|
2018-10-07 04:16:02 +00:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source "${SCRIPT_DIR}/config.sh"
|
|
|
|
|
2020-10-21 11:54:24 +00:00
|
|
|
if [ -z "${1}" ] ; then
|
|
|
|
echo "Usage: $0 <new-version>"
|
|
|
|
echo "Example: $0 0.6.1"
|
2016-12-24 20:41:30 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-10-21 11:54:24 +00:00
|
|
|
function do_replace_docs() {
|
|
|
|
sd "${1}" "${2}" $(fd -t f -e toml -E '/news/*' . "${PROJECT_ROOT}")
|
|
|
|
sd "${1}" "${2}" $(fd -t f -e md -E '/news/*' . "${SITE_ROOT}")
|
2018-10-27 04:20:12 +00:00
|
|
|
}
|
2017-12-15 07:10:21 +00:00
|
|
|
|
2020-10-21 11:54:24 +00:00
|
|
|
function do_replace_all() {
|
|
|
|
sd "${1}" "${2}" $(fd -t f -e rs . "${PROJECT_ROOT}")
|
|
|
|
do_replace_docs "${1}" "${2}"
|
2018-10-27 04:20:12 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 11:54:24 +00:00
|
|
|
NEW_VERSION="${1}"
|
|
|
|
TODAY=$(date "+%b %d, %Y")
|
|
|
|
|
|
|
|
if $PRE_RELEASE; then
|
|
|
|
do_replace_all "/${PHYSICAL_CODENAME}" "/${CODENAME}"
|
|
|
|
do_replace_docs "${PHYSICAL_CODENAME}" "${CODENAME}"
|
|
|
|
else
|
|
|
|
NEW_CODENAME="v$(echo "${NEW_VERSION}" | cut -d'.' -f1-2)"
|
|
|
|
do_replace_all "/${VIRTUAL_CODENAME}" "/${CODENAME}"
|
|
|
|
do_replace_all "/${CODENAME}" "/${NEW_CODENAME}"
|
|
|
|
do_replace_docs "${VIRTUAL_CODENAME}" "${CODENAME}"
|
|
|
|
do_replace_docs "${CODENAME}" "${NEW_CODENAME}"
|
|
|
|
fi
|
2018-10-29 03:12:46 +00:00
|
|
|
|
2020-10-21 11:54:24 +00:00
|
|
|
do_replace_all "${VERSION}" "${NEW_VERSION}"
|
|
|
|
sd "^date.*" "date = \"${TODAY}\"" "${SITE_ROOT}/index.toml"
|