diff --git a/contrib/devtools/update-version.sh b/contrib/devtools/update-version.sh new file mode 100755 --- /dev/null +++ b/contrib/devtools/update-version.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +export LC_ALL=C + +set -euo pipefail + +TOPLEVEL="$(git rev-parse --show-toplevel)" + +help_message() { + echo "Update the version number of the node software." + echo "Usage: $0 " + echo "-v, --version The new version number to use. Increments revision if not specified." +} + +VERSION="" + +# Parse command line arguments +while [[ $# -gt 0 ]]; do +case $1 in + -v|--version) + VERSION="$2" + shift # shift past argument + shift # shift past value + ;; + *) + echo "Unknown argument: $1" + help_message + exit 1 + ;; +esac +done + +CURRENT_VERSION=$(grep -A5 "project.*bitcoin-abc" "${TOPLEVEL}/CMakeLists.txt" | grep "VERSION" | grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+") || { + echo "Error parsing current version number." + exit 2 +} + +if [ -z "${VERSION}" ]; then + MAJOR=$(echo "${CURRENT_VERSION}" | cut -d'.' -f1 ) + MINOR=$(echo "${CURRENT_VERSION}" | cut -d'.' -f2 ) + REVISION=$(echo "${CURRENT_VERSION}" | cut -d'.' -f3 ) + REVISION=$((REVISION + 1)) +else + MAJOR=$(echo "${VERSION}" | cut -d'.' -f1 ) + MINOR=$(echo "${VERSION}" | cut -d'.' -f2 ) + REVISION=$(echo "${VERSION}" | cut -d'.' -f3 ) +fi + +VERSION="${MAJOR}.${MINOR}.${REVISION}" + +# release-notes*.md +RELEASE_NOTES="${TOPLEVEL}/doc/release-notes.md" +mv "${RELEASE_NOTES}" "${TOPLEVEL}/doc/release-notes/release-notes-${CURRENT_VERSION}.md" +echo "Bitcoin ABC version ${VERSION} is now available from: + + + +This release includes the following features and fixes:" > "${RELEASE_NOTES}" + +# CMakeLists +sed -i '$!N;s/\(bitcoin-abc\n\)\(\s*VERSION\s*\).*/\1\2'"${VERSION}"'/;P;D' "${TOPLEVEL}/CMakeLists.txt" + +# configure.ac +CONFIGURE_AC="${TOPLEVEL}/configure.ac" +sed -i "/define(_CLIENT_VERSION_MAJOR, /c\define(_CLIENT_VERSION_MAJOR, $MAJOR)" "${CONFIGURE_AC}" +sed -i "/define(_CLIENT_VERSION_MINOR, /c\define(_CLIENT_VERSION_MINOR, $MINOR)" "${CONFIGURE_AC}" +sed -i "/define(_CLIENT_VERSION_REVISION, /c\define(_CLIENT_VERSION_REVISION, $REVISION)" "${CONFIGURE_AC}" + +# gitian descriptors +sed -i "2s/.*/name: \"bitcoin-abc-${MAJOR}.${MINOR}-win\"/" "${TOPLEVEL}/contrib/gitian-descriptors/gitian-win.yml" +sed -i "2s/.*/name: \"bitcoin-abc-${MAJOR}.${MINOR}-linux\"/" "${TOPLEVEL}/contrib/gitian-descriptors/gitian-linux.yml" +sed -i "2s/.*/name: \"bitcoin-abc-${MAJOR}.${MINOR}-osx\"/" "${TOPLEVEL}/contrib/gitian-descriptors/gitian-osx.yml" diff --git a/doc/release-process.md b/doc/release-process.md --- a/doc/release-process.md +++ b/doc/release-process.md @@ -15,7 +15,7 @@ - Run `arc lint --everything` and check there is no linter error - Ensure that bitcoind and bitcoin-qt run with no issue on all supported platforms. Manually test bitcoin-qt by sending some transactions and navigating through the menus. - + 3. Update the documents / code which needs to be updated every release - Check that doc/release-notes.md is complete, and fill in any missing items. - Update [bips.md](/doc/bips.md) to account for changes since the last release. @@ -34,12 +34,9 @@ git push vM.m.r ``` -5. Increment version number for the next release in: - - doc/release-notes.md (and copy existing one to versioned doc/release-notes/*.md) - - configure.ac - - CMakeLists.txt - - contrib/gitian-descriptors/*.yml (before a new major release) - - contrib/seeds/makeseeds.py (only after a new major release) +5. Increment version number for the next release: + - `contrib/devtools/update-version.sh` + - Bump version in `contrib/seeds/makeseeds.py` (only after a new major release) ## Release