forked from getlantern/lantern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployBinaries.bash
executable file
·62 lines (47 loc) · 1.83 KB
/
deployBinaries.bash
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
#!/usr/bin/env bash
function die() {
echo $*
exit 1
}
if [ $# -ne "3" ]
then
die "$0: Received $# args... dir, name, name of newest file (newest.dmg), and whether this is a release version required"
fi
name=$1
newestName=$2
release=$3
which s3cmd || die "You'll need the s3cmd tool to run this. See https://github.com/s3tools/s3cmd and https://github.com/s3tools/s3cmd/blob/master/INSTALL"
echo "Release version: $release"
# DRY: copys3file.py
bucket=lantern
url=https://s3.amazonaws.com/$bucket/$name
echo "Uploading to http://cdn.getlantern.org/$name..."
if [ $LOCAL_BUILD ] ; then
echo "Not uploading local build"
else
s3cmd put -P $name s3://$bucket
#aws -putp $bucket $name || die "Could not upload"
echo "Uploaded lantern to http://cdn.getlantern.org/$name"
echo "Also available at $url"
fi
if $release ; then
echo "RELEASING!!!!!"
# pushd install/$dir || die "Could not change directories"
# perl -pi -e "s;url_token;$url;g" $newestName || die "Could not replace URL token"
# Makes sure it actually was replaced
# grep $url $newestName || die "Something went wrong with creating newest dummy file"
# Here's the trick -- send a custom mime type that's html instead of the mime type for the file extension
# aws -putpm $bucket $newestName text/html || die "Could not upload newest?"
# git checkout $newestName || die "Could not checkout"
# popd
echo "Copying on S3 to newest file"
./copys3file.py $name $newestName || die "Could not copy s3 file to newest!"
shasum $name | cut -d " " -f 1 > $newestName.sha1
echo "Uploading SHA-1 `cat $newestName.sha1`"
s3cmd put -P $newestName.sha1 s3://$bucket
#aws -putp $bucket $newestName.sha1 || die "Could not upload sha1"
./commitbinary.bash $name $newestName || die "Could not commit binaries?"
else
echo "NOT RELEASING!!!"
fi
echo "INSTALLER AVAILABLE AT `pwd`/$name"