forked from nap/jaro-winkler-distance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·45 lines (36 loc) · 1.36 KB
/
release.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
#!/bin/bash
if ! git diff-index --quiet HEAD; then
echo "Can not process, there's uncommited changes."
exit 1
fi
if echo "$@" | grep -q -- '--version'; then
VERSION=$(echo "$@" | grep -oh -- '--version=.*' | cut -d '=' -f 2 | cut -d ' ' -f 1)
fi
if echo "$@" | grep -q -- '--identity'; then
IDENTITY=$(echo "$@" | grep -oh -- '--identity=.*' | cut -d '=' -f 2 | cut -d ' ' -f 1)
fi
[[ -z "$IDENTITY" ]] && IDENTITY=994A80D2
CURRENT_VERSION=$(sed -n "s/__version__ = '\(.*\)'/\1/p" setup.py)
if [[ -z "$VERSION" ]]; then
echo "Usage: $(basename $0) --version=VERSION [--identity=IDENTITY]"
echo " - Current version: $CURRENT_VERSION"
exit 1
fi
DATE=$(date +%Y-%m-%d)
CHANGELOG=$(mktemp -t tmp)
echo "v$VERSION (${DATE})" > $CHANGELOG
echo "$(git log v${CURRENT_VERSION}..HEAD --oneline | grep -Ev "bump|pypi|pep8|Merge|gitignore|release\.sh")" | while read LINE; do
echo -e " $LINE" >> $CHANGELOG
done
cat CHANGELOG >> $CHANGELOG
cat $CHANGELOG > CHANGELOG
sed -i '' "s/__version__ = '.*'/__version__ = '$VERSION'/" setup.py
sed -i '' "s/:Version: .*/:Version: $VERSION of $DATE/" README.rst
git add README.rst setup.py CHANGELOG
git commit -m "version bump and changelog update"
git push
rm -Rf dist/*
git tag -a v$VERSION -m "pypi version $VERSION"
git push origin v$VERSION
python2.7 setup.py sdist bdist_wheel --universal
twine upload dist/* --sign --identity $IDENTITY