-
Notifications
You must be signed in to change notification settings - Fork 36
/
release.sh
executable file
·39 lines (32 loc) · 1.56 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
#!/bin/sh
# Prompt for versions
# Clean-up release artifact
# Bump version and tag it
# Build a source distrbution and upload on PyPI
# Update version for new develpoment cycle
VERSION_FILE=eztables/__init__.py
CHANGELOG_FILE=CHANGELOG.rst
README_FILE=README.rst
CHANGELOG_CURRENT='Current\n-------'
READ_THE_DOC='http:\/\/django-eztables.readthedocs.org\/en'
CURRENT=$(grep __version__ $VERSION_FILE | sed "s/__version__ = '\(.*\)'/\1/")
echo -n "Current version is $CURRENT, what version do you want to release ? "
read RELEASE
CHANGELOG_VERSION="$RELEASE ($(date +%Y-%m-%d))"
SEP=$( printf "%${#CHANGELOG_VERSION}s" | tr " " "-" )
python setup.py clean
rm -rf *egg-info build dist
sed -i "s/$CURRENT/$RELEASE/" $VERSION_FILE
sed -i "1!N; s/$CHANGELOG_CURRENT/$CHANGELOG_VERSION\n$SEP/" $CHANGELOG_FILE
sed -i "s/$READ_THE_DOC\/latest/$READ_THE_DOC\/$RELEASE/" $README_FILE
git commit $VERSION_FILE $CHANGELOG_FILE $README_FILE -m "Bump version $RELEASE"
git tag $RELEASE
python setup.py register sdist upload
echo -n "Version $RELEASE released, what version do you want for next development cycle ? "
read NEXT
sed -i "s/$RELEASE/$NEXT/" $VERSION_FILE
sed -i "s/$READ_THE_DOC\/$RELEASE/$READ_THE_DOC\/latest/" $README_FILE
sed -i "1!N; s/$CHANGELOG_VERSION/$CHANGELOG_CURRENT\n\n- nothing yet\n\n\n$CHANGELOG_VERSION/" $CHANGELOG_FILE
git commit $VERSION_FILE $CHANGELOG_FILE $README_FILE -m "Updated to version $NEXT for next development cycle"
echo "--------------------------------------------------------------"
echo "Released version $RELEASE and prepare $NEXT development cycle."