From 63ea43d1bba2e11e544cbaceee07f3ae441078a4 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Wed, 18 Dec 2024 16:25:14 -0500 Subject: [PATCH] remove sembump tool as no longer installable with go tools (#1631) * remove sembump tool as no longer installable with go tools * update the documentation: release notes in contributing --- CONTRIBUTING.md | 24 +++++++++++++++--------- Makefile | 8 +------- scripts/bumpversion.sh | 24 ++++++++++++++---------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5233dcd45..365ccb852 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -198,10 +198,9 @@ To cut a release, push a new tag (versioning discussed below). ### Tagging a release -1. Run `make changes` to review the changes since the last - release. Based on the changes, decide what kind of release you are - doing (bugfix, feature or breaking). - `doctl` follows [semantic versioning](https://semver.org), ask if you aren't sure. +1. Run `make changes` to review the changes since the last release. +Based on the changes, decide what kind of release you are doing (bugfix, feature or breaking). +`doctl` follows [semantic versioning](https://semver.org), ask if you aren't sure. 1. Synchronize your local repository with all the tags that have been created or updated on the remote main branch ```bash @@ -209,11 +208,18 @@ To cut a release, push a new tag (versioning discussed below). git pull --tags ``` -1. Creates a new tag and push the tag to the remote repository named origin - ```bash - git tag # Example: git tag v1.113.0 - git push origin tag # Example: git push origin tag v1.113.0 - ``` +1. Tag the release using `BUMP=(bugfix|feature|breaking) make tag`. +Example: + +```bash +BUMP=minor make tag +``` + +Notes on `BUMP=(bugfix|feature|breaking) make tag`: + - BUMP accepts: `bugfix`, `feature`, `breaking` as well as `patch`, `minor` and `major` values. + - The command assumes you have a remote repository named `origin` pointing to this repository. + If you'd prefer to specify a different remote repository, you can do so by setting `ORIGIN=(preferred remote name)`. + - The new tag triggers the release. To learn a bit more about how that all works, check out [goreleaser](https://goreleaser.com/intro) and the config we use for it: [.goreleaser.yml](https://github.com/digitalocean/doctl/blob/main/.goreleaser.yml) diff --git a/Makefile b/Makefile index ac53eac14..36022838d 100644 --- a/Makefile +++ b/Makefile @@ -178,14 +178,8 @@ version: @echo "" @ORIGIN=${ORIGIN} scripts/version.sh -.PHONY: _install_sembump -_install_sembump: - @echo "=> installing/updating sembump tool" - @echo "" - @GO111MODULE=off go get -u github.com/jessfraz/junk/sembump - .PHONY: tag -tag: _install_sembump +tag: @echo "==> BUMP=${BUMP} tag" @echo "" @ORIGIN=${ORIGIN} scripts/bumpversion.sh diff --git a/scripts/bumpversion.sh b/scripts/bumpversion.sh index 55251bd10..956c77a88 100755 --- a/scripts/bumpversion.sh +++ b/scripts/bumpversion.sh @@ -4,18 +4,25 @@ set -euo pipefail ORIGIN=${ORIGIN:-origin} +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +version="$("$DIR"/../scripts/version.sh -s)" +IFS='.' read -r major minor patch <<< "$version" + # Bump defaults to patch. We provide friendly aliases # for patch, minor and major BUMP=${BUMP:-patch} case "$BUMP" in feature | minor) - BUMP="minor" + minor=$((minor + 1)) + patch=0 ;; breaking | major) - BUMP="major" + major=$((major + 1)) + minor=0 + patch=0 ;; *) - BUMP="patch" + patch=$((patch + 1)) ;; esac @@ -27,13 +34,10 @@ elif [[ $(git status --porcelain -b | grep -e "ahead" -e "behind") != "" ]]; the exit 1 fi -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -version="$("$DIR"/../scripts/version.sh -s)" -new_version="v$(sembump --kind "$BUMP" "$version")" - -echo "Bumping version from v${version} to ${new_version}" +echo +new_version="v${major}.${minor}.${patch}" git tag -m "release ${new_version}" -a "$new_version" && git push "${ORIGIN}" tag "$new_version" -echo "" +echo "Bumped version to ${new_version}" + \ No newline at end of file