-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild_all.sh
executable file
·97 lines (82 loc) · 2.61 KB
/
build_all.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
#!/bin/bash
set -e
set -o pipefail
BINARY="cf-mysql-plugin"
main() {
ginkgo -r --randomize-all --randomize-suites --fail-on-pending --cover --trace --race --compilers=2
build_for_platform_and_arch linux amd64
build_for_platform_and_arch linux 386
build_for_platform_and_arch darwin amd64
build_for_platform_and_arch windows amd64
build_for_platform_and_arch windows 386
print_release_yaml
}
build_for_platform_and_arch() {
platform="$1"
arch="$2"
mkdir -p output
build_filename=`build_filename_for_platform "$platform"`
release_name="output/`release_name_for_platform $platform $arch`"
GOOS="$platform" GOARCH="$arch" go build
mv "$build_filename" "$release_name"
hash_val=`shasum ${release_name} | cut -f 1 -d" "`
hash_var_name="hash_${platform}_${arch}"
eval "$hash_var_name=${hash_val}"
}
build_filename_for_platform() {
platform="$1"
case "$platform" in
windows)
echo "$BINARY.exe"
;;
*)
echo "$BINARY"
;;
esac
}
release_name_for_platform() {
platform="$1"
case "$platform" in
windows)
echo "$BINARY-$arch.exe"
;;
*)
echo "$BINARY-$platform-$arch"
;;
esac
}
print_release_yaml() {
prefixed_version=$(git describe --tags)
version=${prefixed_version:1}
updated=$(date "+%Y-%m-%dT%H:%M:%S%z")
cat <<EOF
- name: mysql-plugin
description: Runs mysql and mysqldump clients against your CF database services. Use it to inspect, dump and restore your DB.
version: ${version}
created: 2017-02-02T09:30:00Z
updated: ${updated}
company:
authors:
- name: Andreas Fleig
homepage: https://github.com/andreasf
contact: afleig@pivotal.io
homepage: https://github.com/andreasf/cf-mysql-plugin
binaries:
- platform: osx
url: https://github.com/andreasf/cf-mysql-plugin/releases/download/v${version}/${BINARY}-darwin-amd64
checksum: ${hash_darwin_amd64}
- platform: win64
url: https://github.com/andreasf/cf-mysql-plugin/releases/download/v${version}/${BINARY}-amd64.exe
checksum: ${hash_windows_amd64}
- platform: win32
url: https://github.com/andreasf/cf-mysql-plugin/releases/download/v${version}/${BINARY}-386.exe
checksum: ${hash_windows_386}
- platform: linux32
url: https://github.com/andreasf/cf-mysql-plugin/releases/download/v${version}/${BINARY}-linux-386
checksum: ${hash_linux_386}
- platform: linux64
url: https://github.com/andreasf/cf-mysql-plugin/releases/download/v${version}/${BINARY}-linux-amd64
checksum: ${hash_linux_amd64}
EOF
}
main