From 31eab238505bfea4aa5e7f444884499c916b7411 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Wed, 18 Dec 2024 12:34:27 -0500 Subject: [PATCH] Adjust a release process: remove additional sembump dependency; update release documentation with example, make it a bit shorter --- CONTRIBUTING.md | 27 +++++++++++++++++---------- Makefile | 10 ++-------- scripts/bumpversion.sh | 21 +++++++++++++-------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 493b4281..0152058e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,20 +94,27 @@ number vor the tag. *Before pushing a tag*, the pyproject version needs to be bumped. -1. Run `make changes` to review the merged PRs since last release. +1. Run `make changes` to review the merged PRs since last release and decide what kind of release you are doing (bugfix, feature or breaking). * Review the tags on each PR and make sure they are categorized appropriately. -2. Determine the bump type (major, minor, patch). -3. Run `BUMP=(bugfix|feature|breaking) make bump_version` to update the `pydo` + +1. Run `BUMP=(bugfix|feature|breaking) make bump_version` to update the `pydo` version. * `BUMP` also accepts `(patch|minor|major)` -4. Run `make generate` to update the version in the codebase. -5. Make a pull request with this change. It should be separate from PRs + + Command example: + ```code + make BUMP=minor bump_version + ``` +1. Run `make generate` to update the version in the codebase. Make a pull request with this change. It should be separate from PRs containing changes to the library (including regenerated code). -6. *Once the version bump PR has been pushed and merged*, tag the commit to trigger the - release workflow. - Run `make tag` to tag the latest commit and push the tag to ORIGIN. +1. Once the version bump PR has been pushed and merged, tag the commit to trigger the + release workflow: run `make tag` to tag the latest commit and push the tag to ORIGIN. + + Notes: * To tag an earlier commit, run `COMMIT=${commit} make tag`. * To push the tag to a different remote, run `ORIGIN=${REMOTE} make tag`. -7. Once the release process completes, review the draft release for correctness - and publish the release. Also, ensure the release has been marked `Latest`. +1. Once the release process completes, review the draft release for correctness + and publish the release. + + Ensure the release has been marked `Latest`. diff --git a/Makefile b/Makefile index 00875469..aca1cede 100644 --- a/Makefile +++ b/Makefile @@ -114,14 +114,8 @@ changes: _install_github_release_notes version: @poetry version -.PHONY: _install_sembump -_install_sembump: - @echo "=> installing/updating sembump tool" - @echo "" - @GO111MODULE=off go get -u github.com/jessfraz/junk/sembump - .PHONY: bump_version -bump_version: _install_sembump ## Bumps the version +bump_version: ## Bumps the version @echo "==> BUMP=${BUMP} bump_version" @echo "" @ORIGIN=${ORIGIN} scripts/bumpversion.sh @@ -130,4 +124,4 @@ bump_version: _install_sembump ## Bumps the version tag: ## Tags a release @echo "==> ORIGIN=${ORIGIN} COMMIT=${COMMIT} tag" @echo "" - @ORIGIN=${ORIGIN} scripts/tag.sh \ No newline at end of file + @ORIGIN=${ORIGIN} scripts/tag.sh diff --git a/scripts/bumpversion.sh b/scripts/bumpversion.sh index 81cdef2e..cfcd893b 100755 --- a/scripts/bumpversion.sh +++ b/scripts/bumpversion.sh @@ -7,15 +7,23 @@ ORIGIN=${ORIGIN:-origin} # Bump defaults to patch. We provide friendly aliases # for patch, minor and major BUMP=${BUMP:-patch} + +poetry_version=$(poetry version) +version="${poetry_version:5}" +IFS='.' read -r major minor patch <<< "$version" + 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,10 +35,7 @@ elif [[ $(git status --porcelain -b | grep -e "ahead" -e "behind") != "" ]]; the exit 1 fi -poetry_version=$(poetry version) -version="${poetry_version:5}" -new_version="$(sembump --kind "$BUMP" "$version")" - +new_version="$major.$minor.$patch" poetry version "${new_version#v}" -echo "" \ No newline at end of file +echo ""