summaryrefslogtreecommitdiff
path: root/tasks.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-08-24 13:20:09 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-08-24 13:20:09 -0400
commitac33619741ef4cdbf4ddcda444ea0428d1348ef0 (patch)
treecb1f0eed0a7a335569a0e9228b84c1be1de5b845 /tasks.py
parent59c4ce802ac78c7f845250a8e0c10210b6283800 (diff)
downloadcmd2-git-ac33619741ef4cdbf4ddcda444ea0428d1348ef0.tar.gz
Added a validatetag invoke task to check to make sure a Git tag exists for the current HEAD
Also: - The pypi and pypi-test invoke tasks now have the validatetag task as their first prerequisite - So attempting to publish to pypi without a Git tag will fail
Diffstat (limited to 'tasks.py')
-rw-r--r--tasks.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tasks.py b/tasks.py
index b045b81b..c7b35407 100644
--- a/tasks.py
+++ b/tasks.py
@@ -182,6 +182,13 @@ def tag(context, name='', message=''):
context.run('git push origin {}'.format(name))
namespace.add_task(tag)
+@invoke.task()
+def validatetag(context):
+ "Check to make sure that a tag exists for the current HEAD"
+ # Validate that a Git tag exists for the current commit HEAD
+ context.run("git describe --exact-match --tags $(git log -n1 --pretty='%h')")
+namespace.add_task(validatetag)
+
@invoke.task(pre=[clean_all])
def sdist(context):
"Create a source distribution"
@@ -194,13 +201,13 @@ def wheel(context):
context.run('python setup.py bdist_wheel')
namespace.add_task(wheel)
-@invoke.task(pre=[sdist, wheel])
+@invoke.task(pre=[validatetag, sdist, wheel])
def pypi(context):
"Build and upload a distribution to pypi"
context.run('twine upload dist/*')
namespace.add_task(pypi)
-@invoke.task(pre=[sdist, wheel])
+@invoke.task(pre=[validatetag, sdist, wheel])
def pypi_test(context):
"Build and upload a distribution to https://test.pypi.org"
context.run('twine upload --repository-url https://test.pypi.org/legacy/ dist/*')