Skip to content

Commit

Permalink
Rellu and inv to set version
Browse files Browse the repository at this point in the history
  • Loading branch information
aaltat committed Mar 29, 2021
1 parent 1fd6235 commit 0552d10
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
10 changes: 6 additions & 4 deletions BUILD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Releasing StatusChecker

3. Update ``__version__`` in `<robotstatuschecker.py>`_::

sed -i "s/__version__ = .*/__version__ = '$VERSION'/" robotstatuschecker.py
inv set-version 1.5.0
git diff # verify changes
git commit -m "Updated __version__ to $VERSION" robotstatuschecker.py && git push
git commit -m "Updated __version__ to $VERSION" robotstatuschecker.py
git push

4. Tag::

Expand All @@ -31,9 +32,10 @@ Releasing StatusChecker

8. ``__version__`` back to ``devel``::

sed -i "s/__version__ = .*/__version__ = 'devel'/" robotstatuschecker.py
inv set-version devel
git diff # verify changes
git commit -m "__version__ back to devel" robotstatuschecker.py && git push
git commit -m "__version__ back to devel" robotstatuschecker.py
git push

9. Advertise on mailing lists, `Twitter <https://twitter.com/robotframework>`_,
`LinkedIn <https://www.linkedin.com/groups/3710899>`_, and elsewhere as
Expand Down
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
invoke >= 1.4.1
rellu >= 0.6
twine >= 3.4.1
wheel >= 0.36.2
black >= 20.8b1
47 changes: 47 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from pathlib import Path

from invoke import task
from rellu import initialize_labels, ReleaseNotesGenerator, Version
from rellu.tasks import clean # noqa

VERSION_PATTERN = '__version__ = "(.*)"'
REPOSITORY = "robotframework/statuschecker"
VERSION_PATH = Path("robotstatuschecker.py")
RELEASE_NOTES_PATH = Path("docs/releasenotes/robotstatuschecker-{version}.rst")
RELEASE_NOTES_TITLE = "robotstatuschecker {version}"
RELEASE_NOTES_INTRO = """
StatusChecker is a tool for validating that executed `Robot Framework`_ test cases
have expected statuses and log messages. It is mainly useful for Robot Framework
test library developers who want to use Robot Framework to also test their libraries.
StatusChecker 1.4 and newer are compatible both with Python 2 and Python 3.
StatusChecker project is hosted at GitHub and downloads are at PyPI_
.. _Robot Framework: http://robotframework.org
.. _PyPI: https://github.com/robotframework/statuschecker
.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3A{version.milestone}
"""

@task
def set_version(ctx, version):
"""Set project version in `robotstatuschecker.py`` file.
Args:
version: Project version to set or ``dev`` to set development version.
Following PEP-440 compatible version numbers are supported:
- Final version like 3.0 or 3.1.2.
- Alpha, beta or release candidate with ``a``, ``b`` or ``rc`` postfix,
respectively, and an incremented number like 3.0a1 or 3.0.1rc1.
- Development version with ``.dev`` postfix and an incremented number like
3.0.dev1 or 3.1a1.dev2.
When the given version is ``dev``, the existing version number is updated
to the next suitable development version. For example, 3.0 -> 3.0.1.dev1,
3.1.1 -> 3.1.2.dev1, 3.2a1 -> 3.2a2.dev1, 3.2.dev1 -> 3.2.dev2.
"""
version = Version(version, VERSION_PATH, VERSION_PATTERN)
version.write()
print(version)


@task
def print_version(ctx):
"""Print the current project version."""
print(Version(path=VERSION_PATH, pattern=VERSION_PATTERN))

0 comments on commit 0552d10

Please sign in to comment.