Skip to content

Commit

Permalink
remove sembump tool as no longer installable with go tools (#1631)
Browse files Browse the repository at this point in the history
* remove sembump tool as no longer installable with go tools

* update the documentation: release notes in contributing
  • Loading branch information
loosla authored Dec 18, 2024
1 parent 2ec5fba commit 63ea43d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
24 changes: 15 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,28 @@ 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
git checkout main
git pull --tags
```

1. Creates a new tag and push the tag to the remote repository named origin
```bash
git tag <new-tag> # Example: git tag v1.113.0
git push origin tag <new-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)
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 14 additions & 10 deletions scripts/bumpversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

0 comments on commit 63ea43d

Please sign in to comment.