forked from prestix-studio/cloudns_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish
executable file
·79 lines (56 loc) · 1.43 KB
/
publish
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
CURRENT_BRANCH="$(git symbolic-ref --short -q HEAD)"
echo -e "\n\n ---------------------------------------"
echo -e " Publishing next version of cloudns_api."
echo -e " ---------------------------------------\n\n"
##
# Make sure we are in virtual environment.
if [[ -z ${VIRTUAL_ENV+x} ]] ; then
echo "Must run this from a virtual environment."
echo "Run: source venv/bin/activate"
exit 1
fi
##
# Make sure tests pass.
py.test
if [[ ! $? == 0 ]] ; then
echo "Cannot publish now. Tests do not all pass."
exit 1
fi
##
# Make sure user is ready to publish.
read -p "Are you sure you are ready to publish this version? ($CURRENT_BRANCH) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then
echo "Quitting."
exit 1
fi
##
# Merge version branch with master
git co master
git merge -
if [[ ! $? == 0 ]] ; then
git merge - --no-ff
if [[ ! $? == 0 ]] ; then
echo "Please fix the merge issues."
exit 1
fi
fi
##
# Run build and upload to pypi
python setup.py sdist bdist_wheel
twine check dist/*
if [[ ! $? == 0 ]] ; then
echo "Please fix these issues."
exit 1
fi
read -p "Last chance to back out. Are you sure you are ready to publish this version? ($CURRENT_BRANCH) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then
echo "Quitting."
exit 1
fi
git push
twine upload --skip-existing dist/*
echo "Publish complete."
echo "Don't forget to publish a release in github."