forked from Andre-Tan/EmMAIL
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtasks.py
49 lines (42 loc) · 1.11 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
Automate deployment to PyPi
"""
import invoke
@invoke.task
def deploy_patch(ctx):
"""
Automate deployment
rm -rf build/* dist/*
bumpversion patch --verbose
python3 setup.py sdist bdist_wheel
twine upload dist/*
git push --tags
"""
ctx.run("rm -rf build/* dist/*")
ctx.run("bumpversion patch --verbose")
ctx.run("python3 setup.py sdist bdist_wheel")
ctx.run("twine check dist/*")
ctx.run("twine upload dist/*")
ctx.run("git push --tags")
@invoke.task
def check_for_unstaged_changes(ctx):
"""
If unstaged changes raise an error
"""
try:
ctx.run("git diff-index --quiet HEAD")
except invoke.exceptions.UnexpectedExit as error:
print(("ERROR: There are unstaged changes."))
raise error
except Exception as error:
raise error
@invoke.task(pre=[check_for_unstaged_changes])
def first_deploy(ctx):
"""
First deployment
"""
ctx.run("python3 setup.py sdist bdist_wheel")
ctx.run("twine check dist/*")
ctx.run("twine upload dist/*")
ctx.run("git tag 'v0.1.0'")
ctx.run("git push --tags")