summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2017-05-22 19:06:53 -0300
committerBruno Oliveira <nicoddemus@gmail.com>2017-05-22 19:06:53 -0300
commit5192191c38f17d88509e804e830fc68b4de14633 (patch)
tree7742706e39796c260193077b0a175f484a3197e8
parent3a4d37248d5289591e5703cb3f5a65d557d9960a (diff)
downloadpytest-5192191c38f17d88509e804e830fc68b4de14633.tar.gz
Create task for publishing a release
-rw-r--r--HOWTORELEASE.rst43
-rw-r--r--tasks/generate.py36
-rw-r--r--tasks/release.minor.rst4
3 files changed, 42 insertions, 41 deletions
diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst
index 21834c672..6c0ec5a62 100644
--- a/HOWTORELEASE.rst
+++ b/HOWTORELEASE.rst
@@ -38,47 +38,12 @@ How to release pytest
or look at failures with "devpi list -f pytest".
-#. Feeling confident? Publish to pypi::
+#. Feeling confident? Publish to PyPI::
- devpi push pytest==VERSION pypi:NAME
+ invoke generate.publish_release <VERSION> <DEVPI USER> <PYPI_NAME>
- where NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
+ where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
-#. Tag the release::
- git tag VERSION <hash>
- git push origin VERSION
-
- Make sure ``<hash>`` is **exactly** the git hash at the time the package was created.
-
-#. Send release announcement to mailing lists:
-
- - pytest-dev@python.org
- - python-announce-list@python.org
- - testing-in-python@lists.idyll.org (only for minor/major releases)
-
- And announce the release on Twitter, making sure to add the hashtag ``#pytest``.
-
-#. **After the release**
-
- a. **patch release (2.8.3)**:
-
- 1. Checkout ``master``.
- 2. Update version number in ``_pytest/__init__.py`` to ``"2.8.4.dev0"``.
- 3. Create a new section in ``CHANGELOG.rst`` titled ``2.8.4.dev0`` and add a few bullet points as placeholders for new entries.
- 4. Commit and push.
-
- b. **minor release (2.9.0)**:
-
- 1. Merge ``features`` into ``master``.
- 2. Checkout ``master``.
- 3. Follow the same steps for a **patch release** above, using the next patch release: ``2.9.1.dev0``.
- 4. Commit ``master``.
- 5. Checkout ``features`` and merge with ``master`` (should be a fast-forward at this point).
- 6. Update version number in ``_pytest/__init__.py`` to the next minor release: ``"2.10.0.dev0"``.
- 7. Create a new section in ``CHANGELOG.rst`` titled ``2.10.0.dev0``, above ``2.9.1.dev0``, and add a few bullet points as placeholders for new entries.
- 8. Commit ``features``.
- 9. Push ``master`` and ``features``.
-
- c. **major release (3.0.0)**: same steps as that of a **minor release**
+#. After a minor/major release, merge ``features`` into ``master`` and push (or open a PR).
diff --git a/tasks/generate.py b/tasks/generate.py
index deb77ed4f..cc4791736 100644
--- a/tasks/generate.py
+++ b/tasks/generate.py
@@ -110,3 +110,39 @@ def pre_release(ctx, version, user, password=None):
print()
print('[generate.pre_release] Please push your branch and open a PR.')
+
+@invoke.task(help={
+ 'version': 'version being released',
+ 'user': 'name of the user on devpi to stage the generated package',
+ 'pypi_name': 'name of the pypi configuration section in your ~/.pypirc',
+})
+def publish_release(ctx, version, user, pypi_name):
+ """Publishes a package previously created by the 'pre_release' command."""
+ from git import Repo
+ repo = Repo('.')
+ tag_names = [x.name for x in repo.tags]
+ if version not in tag_names:
+ print('Could not find tag for version {}, exiting...'.format(version))
+ raise invoke.Exit(code=2)
+
+ check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)])
+ check_call(['devpi', 'push', 'pytest=={}'.format(version), 'pypi:{}'.format(pypi_name)])
+ check_call(['git', 'push', 'git@github.com:pytest-dev/pytest.git', version])
+
+ emails = [
+ 'pytest-dev@python.org',
+ 'python-announce-list@python.org'
+ ]
+ if version.endswith('.0'):
+ emails.append('testing-in-python@lists.idyll.org')
+ print('Version {} has been published to PyPI!'.format(version))
+ print()
+ print('Please send an email announcement with the contents from:')
+ print()
+ print(' doc/en/announce/release-{}.rst'.format(version))
+ print()
+ print('To the following mail lists:')
+ print()
+ print(' ', ','.join(emails))
+ print()
+ print('And announce it on twitter adding the #pytest hash tag.')
diff --git a/tasks/release.minor.rst b/tasks/release.minor.rst
index 4bbce5a82..3c0b7d718 100644
--- a/tasks/release.minor.rst
+++ b/tasks/release.minor.rst
@@ -6,10 +6,10 @@ The pytest team is proud to announce the {version} release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
-This release contains a bugs fixes and improvements, so users are encouraged
+This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
-http://doc.pytest.org/en/latest/changelog.html
+ http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit: