-
Notifications
You must be signed in to change notification settings - Fork 26
/
release
executable file
·62 lines (47 loc) · 1.37 KB
/
release
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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