mirror of
https://github.com/adammck/terraform-inventory
synced 2024-11-26 07:43:46 +01:00
30 lines
559 B
Bash
Executable File
30 lines
559 B
Bash
Executable File
#!/bin/bash -e
|
|
cd $(cd `dirname "$0"`; cd ..; pwd)
|
|
|
|
VERSION=$1
|
|
if [ -z $VERSION ]; then
|
|
echo "Usage: $0 VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
TARGETS="darwin_amd64 linux_386 linux_amd64 linux_arm windows_386 windows_amd64"
|
|
|
|
for target in $TARGETS; do
|
|
t=(${target//_/ })
|
|
|
|
export GOOS=${t[0]}
|
|
export GOARCH=${t[1]}
|
|
export NAME=terraform-inventory
|
|
|
|
if [ $GOOS == "windows" ]; then
|
|
NAME=${NAME}.exe
|
|
fi
|
|
|
|
go build -ldflags "-X main.build_version=$VERSION" -o pkg/${NAME}
|
|
|
|
pushd pkg
|
|
zip terraform-inventory_${VERSION}_${GOOS}_${GOARCH}.zip ${NAME}
|
|
rm ${NAME}
|
|
popd
|
|
done
|