Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a script to keep releases clean.

  • Loading branch information...
commit 16c92dca027d788fb9e163945a7c3f4bb9b16290 1 parent 1ac94fc
Chris Read authored
Showing with 64 additions and 1 deletion.
  1. +1 −1  ecks/__init__.py
  2. +63 −0 release
2  ecks/__init__.py
View
@@ -26,7 +26,7 @@
limitations under the License.
"""
-__version__ = '0.2'
+__version__ = '0.3'
__author__ = 'Chris Read <chris.read@gmail.com>'
from ecks import Ecks
63 release
View
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+# Find out where we are
+BASEDIR=$(cd $(dirname $0) && /bin/pwd)
+
+FORCE=$1
+
+check() {
+ CMD=$1
+ shift
+ GREP="$@"
+ (cd $BASEDIR && git $CMD) | grep -q "$GREP"
+ return $?
+}
+
+check_status() {
+ check "status" "^nothing to commit"
+
+ if [ $? -eq 1 ]; then
+ echo "ERROR - Dirty working directory"
+ return 1
+ fi
+
+ check $1 "status" "^# Your branch is ahead of "
+
+ if [ $? -eq 0 ]; then
+ echo "ERROR - Ahead of origin"
+ return 1
+ fi
+
+ check $1 "branch" "^* master"
+
+ if [ $? -eq 1 ]; then
+ if [ ! "$FORCE" == "--force" ]; then
+ echo "ERROR - NOT on master branch"
+ return 1
+ else
+ echo "WARNING - FORCING a release from a non master branch"
+ fi
+ fi
+}
+
+set +e
+check_status
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+set -e
+
+VER=$(python -c "import ecks; print ecks.__version__")
+
+echo "Releasing version ${VER}"
+
+# Tag
+git tag -a "v${VER}" -m "Release version ${VER}"
+
+# Do the release
+python setup.py sdist upload
+
+# Push the tags
+git push --tags
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.