forked from saymedia/terraform-buildkite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·33 lines (28 loc) · 960 Bytes
/
build.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
#!/usr/bin/env bash
set -ex
IFS=$' \n\t'
export PROVIDER_VERSION="0.0.3"
export DISTDIR="$PWD/dist"
export WORKDIR="$PWD"
export GOX_MAIN_TEMPLATE="$DISTDIR/{{.OS}}/{{.Dir}}_v${PROVIDER_VERSION}"
export GOX_ARCH="amd64"
export GOX_OS=${*:-"linux darwin"}
# We'll use gox to cross-compile
go get github.com/mitchellh/gox
# We just assume the cross toolchains are already installed, since on Debian
# there are deb packages for those.
# Build the provider
gox -arch="$GOX_ARCH" -os="$GOX_OS" -output="$GOX_MAIN_TEMPLATE" github.com/saymedia/terraform-buildkite/terraform-provider-buildkite
# ZZZZZZZZZZZZZZZZZZZZIPPIT
echo "--- Build done"
for os in $GOX_OS; do
for arch in $GOX_ARCH; do
echo "--- Zipping $os/$arch"
cd "$DISTDIR/$os"
zip ../terraform-provider-buildkite-v"${PROVIDER_VERSION}"-"$os"-"$arch".zip ./*
done
done
echo "--- DING! Fries are done"
cd "$DISTDIR"
openssl dgst -r -sha256 ./*.zip > sha256s.txt
exit 0