Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add release script

  • Loading branch information...
commit 736bf3b2ad209746a86b157fec9f08952ffd91e9 1 parent 638665b
@batterseapower authored
Showing with 62 additions and 0 deletions.
  1. +62 −0 release
View
62 release
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+
+echo "Have you updated the version number? Type 'yes' if you have!"
+read version_response
+
+if [ "$version_response" != "yes" ]; then
+ echo "Go and update the version number"
+ exit 1
+fi
+
+sdist_output=`runghc Setup.lhs sdist`
+
+if [ "$?" != "0" ]; then
+ echo "Cabal sdist failed, aborting"
+ exit 1
+fi
+
+# Want to find a line like:
+# Source tarball created: dist/ansi-terminal-0.1.tar.gz
+
+# Test this with:
+# runghc Setup.lhs sdist | grep ...
+filename=`echo $sdist_output | sed 's/.*Source tarball created: \([^ ]*\).*/\1/'`
+echo "Filename: $filename"
+
+if [ "$filename" = "$sdist_output" ]; then
+ echo "Could not find filename, aborting"
+ exit 1
+fi
+
+# Test this with:
+# echo dist/ansi-terminal-0.1.tar.gz | sed ...
+version=`echo $filename | sed 's/^[^0-9]*\([0-9\.]*\).tar.gz$/\1/'`
+echo "Version: $version"
+
+if [ "$version" = "$filename" ]; then
+ echo "Could not find version, aborting"
+ exit 1
+fi
+
+echo "This is your last chance to abort! I'm going to upload in 10 seconds"
+sleep 10
+
+git tag "v$version"
+
+if [ "$?" != "0" ]; then
+ echo "Git tag failed, aborting"
+ exit 1
+fi
+
+# You need to have stored your Hackage username and password as directed by cabal-upload
+# I use -v3 because otherwise the error messages can be cryptic :-)
+cabal upload -v3 $filename
+
+if [ "$?" != "0" ]; then
+ echo "Hackage upload failed, aborting"
+ exit 1
+fi
+
+# Success!
+exit 0
Please sign in to comment.
Something went wrong with that request. Please try again.