forked from jlane9/pytest-needle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·50 lines (44 loc) · 984 Bytes
/
publish.sh
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
#!/usr/bin/env bash
while [ $# -gt 0 ]
do
case "$1" in
--) shift; break;;
-*)
echo >&2 \
"usage: $0 [major,minor,patch]"
exit 1;;
*) break;; # terminate while loop
esac
shift
done
# Navigate to project path
cd $(dirname "$0")
# Bump version
if [[ "$1" =~ "minor" ]] || [[ "$1" =~ "major" ]] || [[ "$1" =~ "patch" ]]
then
bumpversion $1
RESULT=$?
else
echo "error: bump version required."
echo "usage $0 [major,minor,patch]"
exit 1
fi
if [ "$RESULT" -eq 0 ]
then
# Get new version
VERSION=$(grep -oEi "[0-9]+\.[0-9]+\.[0-9]+" pytest_needle/__init__.py)
# Release new version
git push --tags origin master
python setup.py sdist bdist_wheel
twine upload dist/*
RELEASED=$?
else
echo "Failed to update to version $VERSION"
exit 1
fi
if [ "$RELEASED" -eq 0 ]
then
echo "${VERSION} released..."
else
echo "Unable to release version ${VERSION}"
fi