-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86bd7c1
commit 08bf1c5
Showing
5 changed files
with
90 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
#! /usr/bin/env bash | ||
|
||
# | ||
# Bumps the version number from <current> to <next> on all libraries. | ||
# Bumps the version number to ${1}. | ||
# | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
source "${SCRIPT_DIR}/config.sh" | ||
|
||
if [ -z "${1}" ] || [ -z "${2}" ]; then | ||
echo "Usage: $0 <current> <next>" | ||
echo "Example: $0 0.1.1 0.1.2" | ||
if [ -z "${1}" ] ; then | ||
echo "Usage: $0 <new-version>" | ||
echo "Example: $0 0.6.1" | ||
exit 1 | ||
fi | ||
|
||
if ! git grep -c "${1}" > /dev/null; then | ||
echo "The version '${1}' doesn't appear to be correct." | ||
echo "Exiting." | ||
exit 1 | ||
fi | ||
|
||
function major() { | ||
echo "${1}" | cut -d'.' -f1-2 | ||
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}") | ||
} | ||
|
||
function do_replace() { | ||
find "${PROJECT_ROOT}" -name "*.rs" | xargs sed -i.bak "s/${1}/${2}/g" | ||
find "${PROJECT_ROOT}" -name "*.toml" | xargs sed -i.bak "s/${1}/${2}/g" | ||
find "${SITE_ROOT}" -name "*.md" | xargs sed -i.bak "s/${1}/${2}/g" | ||
sed -i.bak "s/${1}/${2}/g" "${SCRIPT_DIR}/config.sh" | ||
sed -i.bak "s/${1}/${2}/g" "${PROJECT_ROOT}/README.md" | ||
function do_replace_all() { | ||
sd "${1}" "${2}" $(fd -t f -e rs . "${PROJECT_ROOT}") | ||
do_replace_docs "${1}" "${2}" | ||
} | ||
|
||
do_replace "v$(major ${1})" "v$(major ${2})" | ||
do_replace "${1}" "${2}" | ||
|
||
today=$(date "+%b %d, %Y") | ||
sed -i.bak "s/^date.*/date = \"$today\"/" "${SITE_ROOT}/index.toml" | ||
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 | ||
|
||
find ${PROJECT_ROOT} -name "*.bak" | xargs rm | ||
do_replace_all "${VERSION}" "${NEW_VERSION}" | ||
sd "^date.*" "date = \"${TODAY}\"" "${SITE_ROOT}/index.toml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters