forked from pycontribs/wstools
-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.sh
executable file
·53 lines (40 loc) · 1.51 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
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -ex
VERSION=$(python -c "from wstools.version import __version__ ; print __version__")
echo Preparing to release version $VERSION
echo === Chechink that all changes are commited and pushed ===
git pull
git diff
# Disallow unstaged changes in the working tree
if ! git diff-files --check --exit-code --ignore-submodules -- >&2
then
echo >&2 "error: you have unstaged changes."
#git diff-files --check --exit-code --ignore-submodules -- >&2
exit 1
fi
# Disallow uncommitted changes in the index
if ! git diff-index --cached --exit-code -r --ignore-submodules HEAD -- >&2
then
echo >&2 "error: your index contains uncommitted changes."
exit 1
fi
git log --date=short --pretty=format:"%cd %s" > CHANGELOG
git diff
if [ -v PS1 ] ; then
echo "Automatic deployment"
else
echo "Please don't run this as a user. This generates a new release for PyPI. Press ^C to exit or Enter to continue."
read
fi
git add CHANGELOG
git commit -a "Auto-generating release notes."
git tag -f -a $VERSION -m "Version $VERSION"
git tag -f -a RELEASE -m "Current RELEASE"
NEW_VERSION="${VERSION%.*}.$((${VERSION##*.}+1))"
set -ex
sed -i ~ "s/${VERSION}/${NEW_VERSION}/" wstools/version.py
git commit -a "Auto-increasing the version number after a release."
# disables because this is done only by Travis CI from now, which calls this script after that.
#python setup.py register sdist bdist_wheel build_sphinx upload_docs upload --sign
git push --force origin --tags
echo "done."