-
Notifications
You must be signed in to change notification settings - Fork 2
Branch and release management
This project uses calendar versioning. The scheme is YEAR.MINOR.MICRO, for instance 2023.0.0 or 2023.2.1.
- The major version number is the current year expressed as a 4-digit numeral.
- The minor version number begins with 0 and is incremented for releases that contain significant new features.
- The micro (or "patch") version number begins with 0 and is incremented for release that provide bug fixes or other small changes.
At any time, three branches are in use by the whole team:
-
mainshould always contain the code version that is deployed in production. - There is a development branch for the next patch version. If the current version is 2023.1.1, then there is a branch named
release-2023.1.2. - And there is a development branch for the next minor or major version. If the current version is 2023.1.1, then there is a branch named
release-2023.2.0. Near the end of the year, there may instead be a branch forrelease-2024.0.0.
Note that there is no other dev branch. A common scenario in other projects is to maintain a single dev branch and only commit version-specific changes, like bumping the version number, to release branches. However, we want to allow for parallel development of changes for minor and patch releases, so we have two release branches and no other dev branch. Whenever a patch is released, the minor release branch should be rebased to it (or the patch can be merged into the minor release branch if changes are complex).
In general, development for each issue you work on should be done in its own feature branch. Your code reviewer will merge this branch into the appropriate release branch.
- Decide whether your changes will belong to the next major/minor or patch release. You can change your mind later and rebase your feature branch, but this is troublesome.
- In your local development environment, check out the the release branch you decided upon, and pull changes from GitHub. For instance, if your changes will go in version 2023.2.0, run
git checkout release-2023.2.0
# Or you haven't yet fetched the release branch:
git checkout -b release-2023.2.0 origin/release-2023.2.0
# Make sure your copy of the branch is up to date:
git pull- Create a new local feature development branch. Name the branch in a way that describes your intended changes, and use kebab-case. For instance, your branch might be named
some-new-feature. If you wish, you may use a path-like naming scheme that includes your GitHub username and its number, as injstone-uw/20/some-new-featureto refer to issue #20.
git checkout -b some-new-feature- Make your changes locally and commit them to your local branch.
- Push your feature branch to a new remote branch on the
originremote. For example:
git push -u origin some-new-feature- On GitHub, create a pull request asking to pull the feature branch into the release branch. (In our example, we want to pull
some-new-featurebranch intorelease-2023.2.0.)
Before doing this, you should make sure that the release branch is based on main. If not, rebase it to main (or, in complex cases, merge main into the release branch). This should not be necessary if the procedure given below has been followed for prior releases.
- Resolve any pull requests for the patch's release branch.
- Check out and pull the release branch to your development environment.
git checkout release-2023.1.2
# Or you haven't yet fetched the release branch:
git checkout -b release-2023.1.2 origin/release-2023.1.2
# Make sure your copy of the branch is up to date:
git pull- Edit
src/mavedb/__init__.py. Bump the version number to match the intended release version. - Commit this change and push to GitHub.
git add src/mavedb/__init__.py
git commit -m 'Bumped the version number.'
git push- Reset
mainto point to the head of the release branch. (We are assuming that no other changes have been made to main that are not included in the release branch's history! If they have, go back and rebase the release branch first or mergemaininto it.)
git checkout main
git pull
git reset --hard release-2023.1.2
git push- On GitHub, create a new release.
- Name the release
vYEAR.MINOR.MICRO, e.g.v2023.1.2. - Set a new tag, with the same text as the release name, e.g.
v2023.1.2. The tag will be applied to the latest commit ofmainwhen GitHub creates the release. - Enter a description for the release. This might look like
**Release notes**
- Description of change 1
- Description of change 2
- Etc.- Release the application to production.
- Publish the package to PyPi.
poetry publish --build
- If this was a patch release, rebase the next major/minor release branch onto
main. In complex cases, you may instead mergemaininto the next major/minor release branch.
# In our example, we have just released v2023.1.2 into main.
git rebase main release-2023.2.0
git push -f origin release-2023.2.0- On GitHub, delete the release branch you have just released. You can do this on GitHub's "branches" screen, where the branch should appear as merged and ready to delete.
- In your local environment, switch to the
mainbranch and optionally delete obsolete branches:
git checkout main
git pull
# This is optional. It will remove the branch (origin/some-new-feature) which tracks a now-deleted remote branch.
git remote prune origin- In your local environment, delete the local release branch.
git branch --delete some-new-feature- Create a new major/minor release branch if this was a major/minor release, or a new patch release branch if this was a patch release.
git checkout -b release-2023.1.3
git push origin release-2023.1.3