Skip to content

Commit

Permalink
chore: make sure versioned files are up to date, omit the -next suffix (
Browse files Browse the repository at this point in the history
#103)

* chore: make sure versioned files are up to date, omit the -next suffix

Change-Id: Ic73ebf54c30cc9e9819ee912935434c5c77ca185
Signed-off-by: Nick Boldt <nboldt@redhat.com>

* make commit messages the same

Change-Id: Ia4f08fb17f07cc0fe87821bdf814862f1519559c
Signed-off-by: Nick Boldt <nboldt@redhat.com>

* 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 <nboldt@redhat.com>

---------

Signed-off-by: Nick Boldt <nboldt@redhat.com>
  • Loading branch information
nickboldt authored Sep 18, 2023
1 parent 7a994be commit be6f1b0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.74.0-next
7.75.0
2 changes: 1 addition & 1 deletion cmd/configbump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
29 changes: 24 additions & 5 deletions make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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}"

Expand All @@ -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
Expand Down Expand Up @@ -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}"

0 comments on commit be6f1b0

Please sign in to comment.