-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·66 lines (53 loc) · 1.48 KB
/
publish.sh
File metadata and controls
executable file
·66 lines (53 loc) · 1.48 KB
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
#!/usr/bin/env bash
# ./publish.sh 0.13.37
set -o errexit -o nounset -o pipefail -o xtrace
VERSION="$1"
VERSION_TAG="v${VERSION}"
command -v git
command -v python
command -v twine
publish () {
(
VERSION="$1"
python setup.py sdist
read -r -p "Looks good to publish ${VERSION} to pypi [y/N]? " response
case "$response" in
[yY][eE][sS]|[yY])
twine upload dist/data-kale-${VERSION}.tar.gz
;;
*)
echo "Aborted upload"
exit 5
;;
esac
)
}
(
cd "$( dirname "${BASH_SOURCE[0]}" )"
if [[ $VERSION = v* ]]
then
echo "VERSION should be specified without prefixed v"
exit 6
fi
git fetch
test -z "$(git status --porcelain)" || (echo "Dirty repo"; exit 2)
test -z "$(git diff origin/master)" || (echo "Not up to date with origin/master"; exit 3)
git fetch --tags
git tag -l | sed '/^'"${VERSION_TAG}"'$/{q2}' > /dev/null \
|| (echo "${VERSION_TAG} already exists"; exit 4)
python -m pytest
git diff origin/master
read -r -p "Deploying ${VERSION_TAG}, are you sure? [y/N]? " response
case "$response" in
[yY][eE][sS]|[yY])
git tag "${VERSION_TAG}"
git push origin "${VERSION_TAG}"
git push origin master
publish ${VERSION}
;;
*)
git checkout .
echo "Aborted deploy"
;;
esac
)