mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-05 04:30:16 +03:00
Setup bumpversion
- Create `use_bumpversion` cookiecutter option. - Require `bumpversion==0.5.3` locally. - Refactor version resolution in `./docs/conf.py`: Now, there's a single 'source of truth', the `release` variable representing 'the full version, including alpha/beta/rc tags', allowing the `version` to be derived dynamically from itself. - Provide bumpversion config file pinpointing project version in `./package.json` (the `version` attribute), `./{{cookiecutter.project_slug}}/__init__.py` (the `__version__` variable), and ./docs/conf.py (the `release` variable). N.B. The whole point of refactoring `./docs/conf.py` was indeed to faciilitate seamless version bumping.
This commit is contained in:
parent
33167e64ba
commit
1b79420f8d
|
@ -6,6 +6,7 @@
|
|||
"description": "A short description of the project.",
|
||||
"domain_name": "example.com",
|
||||
"version": "0.1.0",
|
||||
"use_bumpversion": "y",
|
||||
"timezone": "UTC",
|
||||
"use_whitenoise": "y",
|
||||
"use_celery": "n",
|
||||
|
|
22
{{cookiecutter.project_slug}}/.bumpversion.cfg
Normal file
22
{{cookiecutter.project_slug}}/.bumpversion.cfg
Normal file
|
@ -0,0 +1,22 @@
|
|||
[bumpversion]
|
||||
current_version = {{ cookiecutter.version }}
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<pre>\d+)\.(?P<prenum>\d+))?
|
||||
serialize =
|
||||
{major}.{minor}.{patch}-{pre}.{prenum}
|
||||
{major}.{minor}.{patch}
|
||||
commit = True
|
||||
tag = True
|
||||
tag_name = {new_version}
|
||||
|
||||
[bumpversion:file:./package.json]
|
||||
search = "version": "{current_version}"
|
||||
replace = "version": "{new_version}"
|
||||
|
||||
[bumpversion:file:./{{cookiecutter.project_slug}}/__init__.py]
|
||||
search = __version__ = '{current_version}'
|
||||
replace = __version__ = '{new_version}'
|
||||
|
||||
[bumpversion:file:./docs/conf.py]
|
||||
search = release = '{current_version}'
|
||||
replace = release = '{new_version}'
|
||||
|
|
@ -50,10 +50,10 @@ copyright = """{% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}"""
|
|||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.1'
|
||||
release = '{{ cookiecutter.version }}'
|
||||
# The short X.Y version.
|
||||
version = '.'.join(release.split('.')[:2])
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -17,3 +17,6 @@ ipdb==0.10.2
|
|||
|
||||
pytest-django==3.1.2
|
||||
pytest-sugar==0.8.0
|
||||
{% if cookiecutter.use_bumpversion == 'y' -%}
|
||||
bumpversion==0.5.3
|
||||
{%- endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user