From be6f1b07f82c252329a209e4bd40839a0eaa836e Mon Sep 17 00:00:00 2001 From: Nick Boldt Date: Mon, 18 Sep 2023 17:21:05 -0300 Subject: [PATCH] chore: make sure versioned files are up to date, omit the -next suffix (#103) * chore: make sure versioned files are up to date, omit the -next suffix Change-Id: Ic73ebf54c30cc9e9819ee912935434c5c77ca185 Signed-off-by: Nick Boldt * make commit messages the same Change-Id: Ia4f08fb17f07cc0fe87821bdf814862f1519559c Signed-off-by: Nick Boldt * bump to 7.75 since that's what should be in main while 7.74.x has 7.74.0 or .1 Change-Id: If4a6dc6040095087f40b2f66a0aced534711f43b Signed-off-by: Nick Boldt --------- Signed-off-by: Nick Boldt --- README.md | 2 +- VERSION | 2 +- cmd/configbump/main.go | 2 +- make-release.sh | 29 ++++++++++++++++++++++++----- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b6ed249..cad5f80 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ We originally wrote a prototype of this tool in Rust (https://github.com/metlos/ ``` $ ./configbump --help -config-bump 7.74.0-next +config-bump 7.75.0-next Usage: configbump --dir DIR --labels LABELS [--namespace NAMESPACE] Options: diff --git a/VERSION b/VERSION index 350370d..547bef6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.74.0-next +7.75.0 diff --git a/cmd/configbump/main.go b/cmd/configbump/main.go index d100812..db898c7 100644 --- a/cmd/configbump/main.go +++ b/cmd/configbump/main.go @@ -35,7 +35,7 @@ type opts struct { // Version returns the version of the program func (opts) Version() string { - return "config-bump 7.74.0-next" + return "config-bump 7.75.0-next" } const controllerName = "config-bump" diff --git a/make-release.sh b/make-release.sh index 12786b8..82bc91f 100755 --- a/make-release.sh +++ b/make-release.sh @@ -28,6 +28,25 @@ while [[ "$#" -gt 0 ]]; do shift 1 done +sed_in_place() { + SHORT_UNAME=$(uname -s) + if [ "$(uname)" == "Darwin" ]; then + sed -i '' "$@" + elif [ "${SHORT_UNAME:0:5}" == "Linux" ]; then + sed -i "$@" + fi +} + +# search for occurrences of the old version in VERSION file and update to the new version +function update_versioned_files() { + local VER=$1 + OLD_VER=$(cat VERSION); OLD_VER=${OLD_VER%-*} + for file in README.md cmd/configbump/main.go; do + sed_in_place -r -e "s@${OLD_VER}@${VER}@g" $file + done + echo "${VER}" > VERSION +} + bump_version () { CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) @@ -37,10 +56,10 @@ bump_version () { git checkout "${BUMP_BRANCH}" echo "Updating project version to ${NEXT_VERSION}" - update_pkgs_versions $NEXT_VERSION + update_versioned_files $NEXT_VERSION if [[ ${NOCOMMIT} -eq 0 ]]; then - COMMIT_MSG="chore: Bump to ${NEXT_VERSION} in ${BUMP_BRANCH}" + COMMIT_MSG="chore: release: bump to ${NEXT_VERSION} in ${BUMP_BRANCH}" git commit -asm "${COMMIT_MSG}" git pull origin "${BUMP_BRANCH}" @@ -65,7 +84,7 @@ bump_version () { usage () { echo "Usage: $0 --version [VERSION TO RELEASE] [--tag-release]" - echo "Example: $0 --version 7.74.0 --tag-release"; echo + echo "Example: $0 --version 7.75.0 --tag-release"; echo } if [[ ! ${VERSION} ]]; then @@ -124,10 +143,10 @@ git checkout "${BASEBRANCH}" if [[ "${BASEBRANCH}" != "${BRANCH}" ]]; then # bump the y digit, if it is a major release [[ $BRANCH =~ ^([0-9]+)\.([0-9]+)\.x ]] && BASE=${BASH_REMATCH[1]}; NEXT=${BASH_REMATCH[2]}; (( NEXT=NEXT+1 )) # for BRANCH=7.10.x, get BASE=7, NEXT=11 - NEXT_VERSION_Y="${BASE}.${NEXT}.0-next" + NEXT_VERSION_Y="${BASE}.${NEXT}.0" bump_version "${NEXT_VERSION_Y}" "${BASEBRANCH}" fi # bump the z digit [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]] && BASE="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"; NEXT="${BASH_REMATCH[3]}"; (( NEXT=NEXT+1 )) # for VERSION=7.7.1, get BASE=7.7, NEXT=2 -NEXT_VERSION_Z="${BASE}.${NEXT}-next" +NEXT_VERSION_Z="${BASE}.${NEXT}" bump_version "${NEXT_VERSION_Z}" "${BRANCH}"