Repository: HypothesisWorks/hypothesis

Issue:
Zenodo integrations - publish github releases, document DOI link
We now have [Zenodo](https://zenodo.org/) integration set up, ready to archive and mint a citable DOI for each release we make.  This means that we need to start creating github releases as well as tags!

We can write an extra deploy step that uses [the github api](https://developer.github.com/v3/repos/releases/#create-a-release) to create the release.  The body of the release is markdown, and should have a link to the canonical changelog.


Discussion:

Resolving patch:
diff --git a/tooling/src/hypothesistooling/projects/hypothesispython.py b/tooling/src/hypothesistooling/projects/hypothesispython.py
--- a/tooling/src/hypothesistooling/projects/hypothesispython.py
+++ b/tooling/src/hypothesistooling/projects/hypothesispython.py
@@ -23,6 +23,8 @@
 import shutil
 import subprocess
 
+import requests
+
 import hypothesistooling as tools
 import hypothesistooling.releasemanagement as rm
 
@@ -146,6 +148,21 @@ def upload_distribution():
         '--config-file', tools.PYPIRC,
         os.path.join(DIST, '*'),
     ])
+    # Create a GitHub release, to trigger Zenodo DOI minting.  See
+    # https://developer.github.com/v3/repos/releases/#create-a-release
+    requests.post(
+        'https://api.github.com/repos/HypothesisWorks/hypothesis/releases',
+        json=dict(
+            tag_name=tag_name(),
+            name='Hypothesis for Python - version ' + current_version(),
+            body=('You can [read the changelog for this release here]('
+                  'https://hypothesis.readthedocs.io/en/latest/changes.html#v'
+                  '%s).' % (current_version().replace('.', '-'),)),
+        ),
+        timeout=120,  # seconds
+        # Scoped personal access token, stored in Travis environ variable
+        auth=('Zac-HD', os.environ['Zac-release-token']),
+    ).raise_for_status()
 
 
 def current_version():
diff --git a/tooling/src/hypothesistooling/releasemanagement.py b/tooling/src/hypothesistooling/releasemanagement.py
--- a/tooling/src/hypothesistooling/releasemanagement.py
+++ b/tooling/src/hypothesistooling/releasemanagement.py
@@ -27,25 +27,21 @@
 from __future__ import division, print_function, absolute_import
 
 import re
-from datetime import datetime, timedelta
+from datetime import datetime
 
 import hypothesistooling as tools
 
+__RELEASE_DATE_STRING = None
+
 
 def release_date_string():
     """Returns a date string that represents what should be considered "today"
-    for the purposes of releasing. It is always measured in UTC, but if it's in
-    the last hour of the day it will actually be considered tomorrow.
-
-    The reason for counting it as the later day is that it ensures that
-    (unless our release process takes more than 23 hours) this value
-    remains consistent throughout the entire release.
-    """
-    now = datetime.utcnow()
-
-    return max([
-        d.strftime('%Y-%m-%d') for d in (now, now + timedelta(hours=1))
-    ])
+    for the purposes of releasing, and ensure that we don't change part way
+    through a release."""
+    global __RELEASE_DATE_STRING
+    if __RELEASE_DATE_STRING is None:
+        __RELEASE_DATE_STRING = datetime.utcnow().strftime('%Y-%m-%d')
+    return __RELEASE_DATE_STRING
 
 
 def assignment_matcher(name):


Test patch:
diff --git a/requirements/test.in b/requirements/test.in
--- a/requirements/test.in
+++ b/requirements/test.in
@@ -1,5 +1,5 @@
+attrs
 flaky
+mock
 pytest
 pytest-xdist
-mock
-attrs