Skip to content

Commit

Permalink
Release new patch version (#203)
Browse files Browse the repository at this point in the history
* Bump version: 0.13.1 → 0.13.2

* Release new version

* Update changelog
  • Loading branch information
jhpierce authored Mar 10, 2022
1 parent 9f3393a commit 56cdfb6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.13.1
current_version = 0.13.2
commit = True
tag = False

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.13.2] - 2022-03-10

### Changed

- Loosened the Gitpython version requirement range

## [0.13.1] - 2022-01-06

### Added
Expand Down
31 changes: 5 additions & 26 deletions docker/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

set -eo pipefail

DEFAULT_BRANCH="main"

function usage() {
echo "usage: bump_version.sh major|minor|patch"
echo ""
Expand All @@ -19,27 +17,12 @@ else
PART="${1}"
fi

CURRENT_BRANCH=$(git branch --show-current)
CURRENT_STATUS=$(git status --short --untracked-files=no)

if [[ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]]; then
echo "A version bump must be run from the default branch."
echo "Run 'git switch ${DEFAULT_BRANCH}'"
exit 2
elif [[ "$CURRENT_STATUS" != "" ]]; then
echo "The working tree has uncommitted changes."
echo "Commit or stash the changes before running a version bump."
exit 3
fi
# Ensure on default branch
git switch --no-guess main

# Capture value of new version
NEW_VERSION=$(bump2version --dry-run --list "${PART}" | grep new_version | sed -r s,"^.*=",,)
# Create bump branch
BUMP_BRANCH_NAME="bump_version_to_${NEW_VERSION}"
git switch -c "${BUMP_BRANCH_NAME}"
NEW_VERSION=$(bump2version --dry-run --allow-dirty --list "${PART}" | grep new_version | sed -r s,"^.*=",,)

# Update files
bump2version "${PART}"
bump2version "${PART}" --allow-dirty

# Updating the changelog has to be done manually
# - bump2version doesn't support inserting dates https://github.com/c4urself/bump2version/issues/133
Expand All @@ -48,10 +31,6 @@ bump2version "${PART}"
TODAY=$(date +%Y-%m-%d)
sed -i "s/## \[Unreleased\]/## \[Unreleased\]\n\n## \[${NEW_VERSION}\] - ${TODAY}/g" CHANGELOG.md

# Add changelog to bump commit
git add CHANGELOG.md
git commit --amend --no-edit

# Show effected files
git show --pretty="" --name-only

echo "Run 'git push --set-upstream origin ${BUMP_BRANCH_NAME}' to "
14 changes: 8 additions & 6 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ grab the version from `__init__.py` without actually importing any dependencies.

Once the package is ready to be released, there are a few things that need to be done:

1. Start with a local clone of the repo on the default branch with a clean working tree.
2. Run the version bump script with the appropriate part name (`major`, `minor`, or `patch`).
1. Run the version bump script with the appropriate part name (`major`, `minor`, or `patch`).
Example: `docker-compose run --rm bump minor`

This wil create a new branch, updates all affected files with the new version, and commit the changes to the branch.
This will update all affected files (including changelog) with the new version on whichever branch you are on

3. Push the new branch to create a new pull request.
4. Get the pull request approved.
5. Merge the pull request to the default branch.
2. Create a pull request from your branch.
3. Get the pull request approved.
4. Merge the pull request to the default branch.

!!! warning
Take care not to run bump script more than once!

Merging the pull request will trigger a GitHub Action that will create a new release. The creation of this new
release will trigger a GitHub Action that will trigger a wheel build & a source distributions of the package and push them to
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pygitops - 0.13.1
# pygitops - 0.13.2

[![CI pipeline status](https://github.com/wayfair-incubator/pygitops/workflows/CI/badge.svg?branch=main)][ci]

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = pygitops
url = https://github.com/wayfair-incubator/pygitops
author = Josh Woodward
author_email = [email protected]
version = 0.13.1
version = 0.13.2
description = Wrapper for low-level git logic. Useful for systems automating git operations.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit 56cdfb6

Please sign in to comment.