diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-08-24 13:20:09 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-08-24 13:20:09 -0400 |
commit | ac33619741ef4cdbf4ddcda444ea0428d1348ef0 (patch) | |
tree | cb1f0eed0a7a335569a0e9228b84c1be1de5b845 /tasks.py | |
parent | 59c4ce802ac78c7f845250a8e0c10210b6283800 (diff) | |
download | cmd2-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.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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/*') |