Skip to content

Commit

Permalink
Fix version bumping
Browse files Browse the repository at this point in the history
* Migration bump2version (unmaintained) to bump-my-version
* Import `bumpversion.cfg` from `dbt-snowflake`
* Convert `bumpversion.cfg` to `bumpversion.toml`
* Fix a few incorrect version labels
  • Loading branch information
mwallace582 committed Jan 9, 2024
1 parent 3de7325 commit 6a93e44
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 43 deletions.
35 changes: 0 additions & 35 deletions .bumpversion.cfg

This file was deleted.

56 changes: 56 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[tool.bumpversion]
current_version = "1.2.0a1"
parse = '''
(?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
\.(?P<patch>[\d]+) # patch version number
(?P<prerelease> # optional pre-release - ex: a1, b2, rc25
(?P<prekind>a|b|rc) # pre-release type
(?P<num>[\d]+) # pre-release version number
)?
( # optional nightly release indicator
\.(?P<nightly>dev[0-9]+) # ex: .dev02142023
)? # expected matches: `1.15.0`, `1.5.0a11`, `1.5.0a1.dev123`, `1.5.0.dev123457`, expected failures: `1`, `1.5`, `1.5.2-a1`, `text1.5.0`
'''
serialize = [
"{major}.{minor}.{patch}{prekind}{num}.{nightly}",
"{major}.{minor}.{patch}.{nightly}",
"{major}.{minor}.{patch}{prekind}{num}",
"{major}.{minor}.{patch}",
]
commit = false
tag = false

[tool.bumpversion.parts.prekind]
first_value = "a"
optional_value = "final"
values = [
"a",
"b",
"rc",
"final",
]

[tool.bumpversion.parts.num]
first_value = "1"

[[tool.bumpversion.files]]
filename = "setup.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mysql/__version__.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mysql5/__version__.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mariadb/__version__.py"

[[tool.bumpversion.files]]
filename = "dev-requirements.txt"
parse = '''
(?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
.latest
'''
serialize = ["{major}.{minor}.latest"]
10 changes: 5 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
1. Open a branch for the release
- `git checkout -b releases/1.5.0`
1. Update [`CHANGELOG.md`](CHANGELOG.md) with the most recent changes
1. Bump the version using [`bump2version`](https://github.com/c4urself/bump2version/#bump2version):
1. Dry run first by running `bumpversion --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
1. Bump the version using [`bump-my-version`](https://github.com/callowayproject/bump-my-version):
1. Dry run first by running `bump-my-version bump --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
- Release candidates: `--new-version 1.5.0rc1 num`
- Alpha releases: `--new-version 1.5.0a1 num`
- Patch releases: `--new-version 1.5.1 patch`
- Minor releases: `--new-version 1.5.0 minor`
- Major releases: `--new-version 2.0.0 major`
1. Actually modify the files: `bumpversion --no-tag --new-version <desired-version> <part>`. An example:
- Minor releases: `bumpversion --no-tag --new-version 1.5.0 minor`
1. Actually modify the files: `bump-my-version bump --no-tag --new-version <desired-version> <part>`. An example:
- Minor releases: `bump-my-version bump --no-tag --new-version 1.5.0 minor`
1. Check the diff with `git diff`
1. Add the files that were changed with `git add --update`
1. Commit with message `Release dbt-mysql v<desired-version>`
Expand Down Expand Up @@ -60,7 +60,7 @@ PyPI recognizes [pre-release versioning conventions](https://packaging.python.or
- `git pull`
- `git checkout -b bump-1.6.0a1`
- Minor releases:
`bumpversion --no-tag --new-version 1.6.0a1 num`
`bump-my-version bump --no-tag --new-version 1.6.0a1 num`
- Update the branch names in `dev-requirements.txt` from `@{previous-version}.latest` to `@{minor-version}.latest` (or `@main`)
- Commit with message `Bump dbt-mysql 1.6.0a1`
- `git push`
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# install latest changes in dbt-core
# TODO: how to automate switching from develop to version branches?
# git+https://github.com/dbt-labs/dbt-core.git@1.4.latest#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-core.git@1.4.latest#egg=dbt-tests-adapter&subdirectory=tests/adapter
git+https://github.com/dbt-labs/dbt-core.git@1.2.latest#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-core.git@1.2.latest#egg=dbt-tests-adapter&subdirectory=tests/adapter

# if version 1.x or greater -> pin to major version
# if version 0.x -> pin to minor
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_dbt_core_version():


package_name = "dbt-mysql"
package_version = "1.4.0a1"
package_version = "1.2.0a1"
dbt_core_version = _get_dbt_core_version()
description = """The MySQL adapter plugin for dbt"""

Expand Down

0 comments on commit 6a93e44

Please sign in to comment.