forked from Synerty/wstools-py3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·43 lines (31 loc) · 970 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
#!/usr/bin/env bash
PACKAGE="wstools-py3"
set -o nounset
set -o errexit
#set -x
if [ -n "$(git status --porcelain)" ]; then
echo "There are uncomitted changes, please make sure all changes are comitted" >&2
exit 1
fi
if ! [ -f "setup.py" ]; then
echo "setver.sh must be run in the directory where setup.py is" >&2
exit 1
fi
VER="${1:?You must pass a version of the format 0.0.0 as the only argument}"
if git tag | grep -q "${VER}"; then
echo "Git tag for version ${VER} already exists." >&2
exit 1
fi
echo "Setting version to $VER"
## Update the setup.py
#sed -i "s;^package_version.*=.*;package_version = '${VER}';" setup.py
# Update the package version
sed -i "s;.*version.*;__version__ = '${VER}';" wstools/version.py
# Upload to pypi
python setup.py sdist upload
# Reset the commit, we don't want versions in the commit
git commit -a -m "Updated to version ${VER}"
git tag ${VER}
git push
git push --tags
echo "Package deployed"