Skip to content

Commit

Permalink
Automatically mint DOIs for new releases
Browse files Browse the repository at this point in the history
Via Zenodo integration with Github releases
  • Loading branch information
Zac-HD committed Sep 11, 2018
1 parent 5b8bd02 commit 1c444b5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CITATION
@@ -1,5 +1,6 @@
Please use one of the following samples to cite the hypothesis version
(change x.y to the version you are using) from this installation.
You may wish to include the DOI, https://doi.org/10.5281/zenodo.1412597

Text:

Expand Down
8 changes: 8 additions & 0 deletions hypothesis-python/RELEASE.rst
@@ -0,0 +1,8 @@
RELEASE_TYPE: patch

This is a no-op release, which implements automatic DOI minting and code
archival of Hypothesis via `Zenodo <https://zenodo.org/>`_. Thanks to
CERN and the EU *Horizon 2020* programme for providing this service!

Check our :gh-file:`CITATION` file for details, or head right on over to
`doi.org/10.5281/zenodo.1412597 <https://doi.org/10.5281/zenodo.1412597>`_
1 change: 1 addition & 0 deletions requirements/tools.in
Expand Up @@ -15,6 +15,7 @@ pyformat
pytest
python-dateutil
pyupio
requests
restructuredtext-lint
sphinx
sphinx-rtd-theme
Expand Down
2 changes: 1 addition & 1 deletion requirements/tools.txt
Expand Up @@ -67,7 +67,7 @@ pytz==2018.5 # via babel, django
pyupio==1.0.2
pyyaml==3.13 # via bandit, dparse, pyupio
requests-toolbelt==0.8.0 # via twine
requests==2.19.1 # via pygithub, python-gitlab, pyupio, requests-toolbelt, safety, sphinx, twine
requests==2.19.1
restructuredtext-lint==1.1.3
safety==1.8.4 # via pyupio
simplegeneric==0.8.1 # via ipython
Expand Down
17 changes: 17 additions & 0 deletions tooling/src/hypothesistooling/projects/hypothesispython.py
Expand Up @@ -23,6 +23,8 @@
import shutil
import subprocess

import requests

import hypothesistooling as tools
import hypothesistooling.releasemanagement as rm

Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 1c444b5

Please sign in to comment.