diff --git a/contrib/devtools/version-update.sh b/contrib/devtools/version-update.sh new file mode 100755 --- /dev/null +++ b/contrib/devtools/version-update.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Update the software version number + +usage() { + echo "Usage: ${0} " + echo + echo "Version number format should match the following pattern:" + echo " MAJOR.MINOR.REVISION" + echo + echo "Example: ${0} 0.18.7" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +# Check the version number is well-formed +# Format: MAJOR.MINOR.REVISION +VERSION=`echo "${1}" | grep -E '^(([[:digit:]])+\.){2}[[:digit:]]+$'` +if [ $? -ne 0 ]; then + usage + exit 2 +fi + +echo "Updating to version ${VERSION}..." + +TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} + +IFS='.' read -a VER_ARRAY <<< "${1}" +MAJOR=${VER_ARRAY[0]} +MINOR=${VER_ARRAY[1]} +REVISION=${VER_ARRAY[2]} + +# configure.ac +echo "Updating ${TOPDIR}/configure.ac" +sed -ri "s/(define\(_CLIENT_VERSION_MAJOR, )[[:digit:]]+/\1${MAJOR}/g" ${TOPDIR}/configure.ac +sed -ri "s/(define\(_CLIENT_VERSION_MINOR, )[[:digit:]]+/\1${MINOR}/g" ${TOPDIR}/configure.ac +sed -ri "s/(define\(_CLIENT_VERSION_REVISION, )[[:digit:]]+/\1${REVISION}/g" ${TOPDIR}/configure.ac + +# Doxyfile +echo "Updating ${TOPDIR}/doc/Doxyfile" +sed -ri "s/^(PROJECT_NUMBER\s+= )[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+/\1${VERSION}/g" ${TOPDIR}/doc/Doxyfile + +# release-notes.md +CURRENT_VERSION=`head -n1 ${TOPDIR}/doc/release-notes.md | grep -Eo '([[:digit:]]+\.){2}[[:digit:]]'` +echo "Copying current release notes to ${TOPDIR}/doc/release-notes/release-notes-${CURRENT_VERSION}.md" +cp ${TOPDIR}/doc/release-notes.md ${TOPDIR}/doc/release-notes/release-notes-${CURRENT_VERSION}.md +echo "Creating new empty ${TOPDIR}/doc/release-notes.md" +echo "Bitcoin ABC version ${VERSION} is now available from:" > ${TOPDIR}/doc/release-notes.md +echo >> ${TOPDIR}/doc/release-notes.md +echo " " >> ${TOPDIR}/doc/release-notes.md +echo >> ${TOPDIR}/doc/release-notes.md +echo "This release includes the following features and fixes:" >> ${TOPDIR}/doc/release-notes.md + +# CMakeLists.txt +echo "Updating ${TOPDIR}/src/config/CMakeLists.txt" +sed -ri "s/(set\(CLIENT_VERSION_MAJOR )[[:digit:]]+/\1${MAJOR}/g" ${TOPDIR}/src/config/CMakeLists.txt +sed -ri "s/(set\(CLIENT_VERSION_MINOR )[[:digit:]]+/\1${MINOR}/g" ${TOPDIR}/src/config/CMakeLists.txt +sed -ri "s/(set\(CLIENT_VERSION_REVISION )[[:digit:]]+/\1${REVISION}/g" ${TOPDIR}/src/config/CMakeLists.txt + +# gitian-OS.yml +for OS in linux osx win +do + echo "Updating ${TOPDIR}/contrib/gitian-descriptors/gitian-${OS}.yml" + sed -ri "s/(bitcoin-abc-)[[:digit:]]+\.[[:digit:]]+(-${OS})/\1${MAJOR}.${MINOR}\2/g" ${TOPDIR}/contrib/gitian-descriptors/gitian-${OS}.yml +done + +echo "...done." + diff --git a/doc/release-process.md b/doc/release-process.md --- a/doc/release-process.md +++ b/doc/release-process.md @@ -45,12 +45,14 @@ ## After Release -9. Increment version number in: - - doc/Doxyfile - - doc/release-notes.md (and copy existing one to versioned doc/release-notes/*.md) - - configure.ac - - src/config/CMakeLists.txt - - contrib/gitian-descriptors/*.yml (before a new major release) +9. Increment version number: + - Run the script: `contrib/devtools/version-update.sh ` + - Check that the following files are updated with the new version: + - doc/Doxyfile + - doc/release-notes.md (and the previous one get copied to versioned doc/release-notes/*.md) + - configure.ac + - src/config/CMakeLists.txt + - contrib/gitian-descriptors/*.yml (only after a new major release) 10. Update version number on www.bitcoinabc.org