-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_release.sh
executable file
·73 lines (60 loc) · 1.4 KB
/
make_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -e
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${CUR_DIR}"
TWINE_REPOSITORY='pypi'
BIN_DIR="${CUR_DIR}/bin"
PYTHON="${CUR_DIR}/bin/twine_python"
TWINE="${CUR_DIR}/bin/twine"
cd src
echo "Check MANIFEST"
${BIN_DIR}/check-manifest -p "${PYTHON}"
echo
echo "Build SDIST and WHEEL"
${PYTHON} setup.py -q sdist bdist_wheel
echo
echo "Check dists by Twine"
${TWINE} check dist/*
rm -rf dist build
echo
echo "Check not committed changes"
NOT_COMMITTED=$(git status --untracked-files=no --porcelain)
if [[ "$NOT_COMMITTED" ]]
then
echo "ERROR: You have not committed changes!"
exit 1
fi
echo
echo "Update version in CHANGES.rst"
VERSION='auto'
if [[ $1 ]]
then
VERSION=$1
fi
VERSION=$(${PYTHON} version.py -u ${VERSION})
if [[ -z "$VERSION" ]]
then
echo "ERROR: File CHANGES.rst not changed!"
exit 1
fi
NOT_COMMITTED=$(git status --untracked-files=no --porcelain)
if [[ "$NOT_COMMITTED" ]]
then
echo Commit updated CHANGES.rst for version ${VERSION}
git add CHANGES.rst
git commit -m "Create release"
echo Push changes to repository
git push
echo Create tag v${VERSION}
git tag -a -f -m "Version ${VERSION}" v${VERSION}
git push --tags
fi
cd "${CUR_DIR}"
echo "Make release"
cd src
rm -rf dist build
${PYTHON} setup.py sdist bdist_wheel
TWINE_REPOSITORY=${TWINE_REPOSITORY} ${TWINE} upload dist/*
rm -rf dist build
cd "${CUR_DIR}"
echo "OK"