Skip to content
This repository
Newer
Older
100755 105 lines (76 sloc) 2.578 kb
ea608964 »
2008-08-31 Add release script
1 #!/bin/bash
2 #
3
05e5ddfa »
2010-05-08 Do not allow making a release if you are not on the master branch (doh)
4 if [ "$(git branch | grep '* ')" != "* master" ]; then
5 echo "You are not on the master branch!"
6 exit 1
7 fi
8
ea608964 »
2008-08-31 Add release script
9 echo "Have you updated the version number? Type 'yes' if you have!"
10 read version_response
11
12 if [ "$version_response" != "yes" ]; then
13 echo "Go and update the version number"
14 exit 1
15 fi
16
17
13165379 »
2008-10-07 Add a note to the effect that we don't want to upload the example
18 # Not 'example' as well because we don't really want to upload a simple example package to Hackage.
32f097ef »
2009-02-26 Add QuickCheck2 to release script
19 declare -a subdirectories=(core hunit quickcheck quickcheck2)
e9377398 »
2008-10-07 Update release script to cope with several packages
20 declare -a filenames
ea608964 »
2008-08-31 Add release script
21
e9377398 »
2008-10-07 Update release script to cope with several packages
22 index=0
1a35255f »
2008-10-07 Problem with bash element count syntax
23 while [ "$index" -lt "${#subdirectories[@]}" ]; do
e9377398 »
2008-10-07 Update release script to cope with several packages
24 # Find out the working subdirectory and enter it
25 subdirectory=${subdirectories[index]}
26 cd $subdirectory
ea608964 »
2008-08-31 Add release script
27
e49c867d »
2009-05-22 Change release script so it configures before sdist, to support CPP
28 # For those directories that use CPP, we need to configure before sdist will work without a warning
29 runghc Setup.lhs configure --user
005248b4 »
2011-10-29 Remove whitespace [Gun.io WhitespaceBot]
30
e49c867d »
2009-05-22 Change release script so it configures before sdist, to support CPP
31 # OK, build the tarball
e9377398 »
2008-10-07 Update release script to cope with several packages
32 sdist_output=`runghc Setup.lhs sdist`
ea608964 »
2008-08-31 Add release script
33
e9377398 »
2008-10-07 Update release script to cope with several packages
34 if [ "$?" != "0" ]; then
35 echo "Cabal sdist failed, aborting"
36 exit 1
37 fi
ea608964 »
2008-08-31 Add release script
38
39
e9377398 »
2008-10-07 Update release script to cope with several packages
40 # Want to find a line like:
41 # Source tarball created: dist/ansi-terminal-0.1.tar.gz
42
43 # Test this with:
44 # runghc Setup.lhs sdist | grep ...
45 filename=`echo $sdist_output | sed 's/.*Source tarball created: \([^ ]*\).*/\1/'`
46 filenames[$index]="$subdirectory/$filename"
47 echo "Filename: $filename"
48
49 if [ "$filename" = "$sdist_output" ]; then
50 echo "Could not find filename, aborting"
51 exit 1
52 fi
53
ea608964 »
2008-08-31 Add release script
54
e9377398 »
2008-10-07 Update release script to cope with several packages
55 if [ "$subdirectory" = "core" ]; then
56 # Test this with:
57 # echo dist/ansi-terminal-0.1.tar.gz | sed ...
58 version=`echo $filename | sed 's/^[^0-9]*\([0-9\.]*\).tar.gz$/\1/'`
59 echo "Version: $version"
60
61 if [ "$version" = "$filename" ]; then
62 echo "Could not find version, aborting"
63 exit 1
64 fi
65 fi
66
67
68 # Move to the next directory
69 cd ..
70 let "index = $index + 1"
71 done
72
73
74 echo "This is your last chance to abort! I'm going to upload v$version in 10 seconds"
ea608964 »
2008-08-31 Add release script
75 sleep 10
76
e9377398 »
2008-10-07 Update release script to cope with several packages
77
3361e547 »
2010-04-28 Tweak the release script
78 if [ -n "$version" ]; then
79 git tag "v$version"
ea608964 »
2008-08-31 Add release script
80
3361e547 »
2010-04-28 Tweak the release script
81 if [ "$?" != "0" ]; then
82 echo "Git tag failed, aborting"
83 exit 1
84 fi
ea608964 »
2008-08-31 Add release script
85 fi
86
87
e9377398 »
2008-10-07 Update release script to cope with several packages
88 index=0
1a35255f »
2008-10-07 Problem with bash element count syntax
89 while [ "$index" -lt "${#filenames[@]}" ]; do
e9377398 »
2008-10-07 Update release script to cope with several packages
90 # You need to have stored your Hackage username and password as directed by cabal-upload
91 # I use -v5 because otherwise the error messages can be cryptic :-)
92 filename=${filenames[index]}
faaaa838 »
2010-07-08 Use cabal upload for release script
93 cabal upload -v3 $filename
e9377398 »
2008-10-07 Update release script to cope with several packages
94
95 if [ "$?" != "0" ]; then
96 echo "Hackage upload of $filename failed, aborting"
97 exit 1
98 fi
005248b4 »
2011-10-29 Remove whitespace [Gun.io WhitespaceBot]
99
e9377398 »
2008-10-07 Update release script to cope with several packages
100 let "index = $index + 1"
101 done
ea608964 »
2008-08-31 Add release script
102
103 # Success!
faaaa838 »
2010-07-08 Use cabal upload for release script
104 exit 0
Something went wrong with that request. Please try again.