Skip to content

Commit

Permalink
Script the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmitterdorfer committed Jun 28, 2016
1 parent bbb425f commit f3898c8
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 6 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -4,6 +4,7 @@ include LICENSE
include MANIFEST.in
include README.rst
include setup.py
include version.txt
recursive-include docs *
recursive-include esrally/resources *
# recursive-exclude * __pycache__
Expand Down
12 changes: 11 additions & 1 deletion docs/conf.py
Expand Up @@ -16,6 +16,7 @@
import sys
import os
import pkg_resources
from os.path import join, dirname

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -56,7 +57,16 @@
# built documents.
#
# The short X.Y version.
version = "0.3.1"


# development versions always have the suffix '.dev0'
def read_version():
with open(join(dirname(__file__), os.pardir, "version.txt")) as f:
raw_version = f.read().strip()
return raw_version.replace(".dev0", "")


version = read_version()
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
63 changes: 63 additions & 0 deletions release.sh
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

# fail this script immediately if any command fails with a non-zero exit code
set -e

# test number of parameters
if [ $# != 2 ]
then
echo "Usage: $0 RELEASE_VERSION NEXT_VERSION"
exit 1
fi

RELEASE_VERSION=$1
NEXT_RELEASE="$2.dev0"

echo "============================="
echo "Preparing Rally release $RELEASE_VERSION"
echo "============================="

# * Update version in `setup.py` and `docs/conf.py`
echo "$RELEASE_VERSION" > version.txt
git commit -a -m 'Bump version to $RELEASE_VERSION'

cd docs && make html && cd -
# run integration tests, note that this requires that tox is properly set up
tox

python3 setup.py develop

# Check version
if [ "`esrally --version`" != "esrally $RELEASE_VERSION" ]
then
echo "ERROR: Rally version string [`esrally --version`] does not match expected version [esrally $RELEASE_VERSION]"
exit 2
fi

# Build new version
python3 setup.py bdist_wheel
# Upload to PyPI
twine upload dist/esrally-${RELEASE_VERSION}-*.whl

# Create release tag
git tag -a ${RELEASE_VERSION} -m 'Rally release $RELEASE_VERSION'
git push --tags

# Update version to next dev version
echo "$NEXT_RELEASE" > version.txt

# Install locally for development
python3 setup.py develop

git commit -a -m 'Continue in $NEXT_RELEASE'
git push origin master

echo ""
echo "===================="
echo "Released Rally $RELEASE_VERSION"
echo "===================="
echo ""
echo "Manual tasks:"
echo ""
echo "* Close milestone on Github: https://github.com/elastic/rally/milestones/$RELEASE_VERSION"
echo "* Announce on Discuss: https://discuss.elastic.co/c/annoucements"
15 changes: 10 additions & 5 deletions setup.py
@@ -1,13 +1,18 @@
from os.path import join, dirname
from setuptools import setup, find_packages

VERSION = (0, 3, 1, "dev0")

def str_from_file(name):
with open(join(dirname(__file__), name)) as f:
return f.read().strip()


raw_version = str_from_file("version.txt")
VERSION = raw_version.split(".")
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))
__versionstr__ = raw_version

f = open(join(dirname(__file__), "README.rst"))
long_description = f.read().strip()
f.close()
long_description = str_from_file("README.rst")

install_requires = [
"elasticsearch==2.3.0",
Expand Down
1 change: 1 addition & 0 deletions version.txt
@@ -0,0 +1 @@
0.3.1.dev0

0 comments on commit f3898c8

Please sign in to comment.