forked from sspencer/colorart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·112 lines (90 loc) · 2.94 KB
/
release.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
function usage {
echo -e "colorart release script\n"
echo "Usage:"
echo " $0 version"
exit 1
}
version=$1
if [ -z "$version" ]; then
usage
fi
if [ ! -d "bin" ]; then
mkdir bin
fi
function xc {
echo ">>> Cross compiling colorart"
cd bin/
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${version}" -o colorart-${version}-linux-amd64
GOOS=linux GOARCH=386 go build -ldflags "-X main.version=${version}" -o colorart-${version}-linux-i386
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${version}" -o colorart-${version}-darwin-amd64
cd ../
}
function deb {
arches="i386 amd64"
for arch in $arches; do
echo -e "\n>>> Creating debian package for ${arch}"
fpm \
-f \
-s dir \
-t deb \
--vendor "DeLaTech" \
--name "colorart" \
--description "An utility that extracts colors from an image (similiar to iTunes 11+)" \
--version $version \
-a $arch \
-p ./bin/colorart-${version}-${arch}.deb \
./bin/colorart-${version}-linux-${arch}=/usr/bin/colorart
done
}
function osx {
echo -e "\n>>> Creating osx package"
fpm \
-f \
-s dir \
-t tar \
--name "colorart" \
-p ./bin/colorart-darwin-${version}.tar \
./bin/colorart-${version}-darwin-amd64=/usr/bin/colorart
}
function publish_debian {
echo -e ">>> Publishing debian packages"
aptly repo create delatech
aptly repo add delatech bin/colorart-${version}-i386.deb
aptly repo add delatech bin/colorart-${version}-amd64.deb
aptly snapshot create delatech-colorart-${version} from repo delatech
# for first tie use
# aptly publish -distribution=squeeze snapshot delatech-colorart-${version} s3:apt.delatech.net:
aptly publish switch squeeze s3:apt.delatech.net: delatech-colorart-${version}
}
function publish_homebrew {
echo -e "\n>>> Publishing osx package"
gzip -f ./bin/colorart-darwin-${version}.tar
sha1sum=`sha1sum ./bin/colorart-darwin-${version}.tar.gz | awk '{print $1}'`
aws s3 cp bin/colorart-darwin-${version}.tar.gz s3://release.delatech.net/colorart/colorart-${version}.tar.gz --acl=public-read
cat <<EOF > $DELATECH_BREWTAP/Formula/colorart.rb
#encoding: utf-8
require 'formula'
class Colorart < Formula
homepage 'https://github.com/delatech/colorart'
version '${version}'
url 'http://release.delatech.net.s3-website-eu-west-1.amazonaws.com/colorart/colorart-${version}.tar.gz'
sha1 '${sha1sum}'
depends_on :arch => :intel
def install
bin.install 'bin/colorart'
end
end
EOF
cd $DELATECH_BREWTAP
git add Formula/colorart.rb
git ci -m"Update colorart to v${version}"
git push origin master
}
export AWS_ACCESS_KEY_ID=$AWS_DELATECH_S3_APT_KEY
export AWS_SECRET_ACCESS_KEY=$AWS_DELATECH_S3_APT_SECRET
xc
deb
publish_debian
osx
publish_homebrew