-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·36 lines (27 loc) · 803 Bytes
/
publish.sh
File metadata and controls
executable file
·36 lines (27 loc) · 803 Bytes
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
#!/bin/bash
echo "As a developer, use this script to upload a new version of the package to PyPI."
echo
function confirm {
read -r -p "$1 [y/N]: " ANSWER
[[ "$ANSWER" =~ ^(y|Y) ]]
}
NAME_VERSION=`python3 setup.py --name --version 2>/dev/null | tail -n 2`
NAME=`echo "$NAME_VERSION" | head -n 1`
VERSION=`echo "$NAME_VERSION" | tail -n 1`
if ! confirm "Have you created and checked out git tag '$VERSION'?"; then
echo "Quitting."
exit
fi
# Create package
echo
python3 setup.py sdist
# Check for errors
echo
python3 -m twine check "dist/$NAME-$VERSION.tar.gz" || exit 1
echo
confirm "Do you want to publish version '$VERSION' of '$NAME' to PyPI?" || exit
echo
echo "Publishing '$NAME' version '$VERSION'"
# Upload package
echo
python3 -m twine upload "dist/$NAME-$VERSION.tar.gz"