diff --git a/.travis.yml b/.travis.yml index 7e0d7f4..28f07c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,11 @@ deploy: api_key: secure: ONgfa6uGlzqX9HKizki9Hemw2b68/0d+vlFsq+k6R0KQKhzmD7TnuUNewpAC4ELQtPUQtttknplwLpdPPhY/JcUxJ7/GHxuToeFRzT4Zz8aU6zuCeegM9rRRjPsRtYeB5OHLtiresmPng1OfEhWBoaeOS0aBHb/aQKORQTYr86Q6v7L2u43ikfXMzqFZtjdJnvNbRZqBY/8HfUKhGDhFeW8WXvXvyvFIHmoLKWgcznbW2bBh8GKdv+O/1JPqfAnSZhHrTYV/k+kW6zx8Qyq2VfvN/r97zfjxoDxTHumnyWmZyozXIoHlPxF8aR6OtmSybEV2QvWNwUkhBpKQtvvFn3+egQlfJjdRBizJXYgSwry4307WpY+cBz6rEdN8JajOAXff03uC1mLxsK527afengjuEI/d6lLAKuyz0985yTH/pqetowOwE8U8+BSRwc7/ja8VBAmCv7HS2sI0qsyoaDpunFBeRS8s/QVTsgoKsFtLzHI69vywo/rqUqOJFi3KxPVghdN3vE6f5IauvQeNuDIpV9+7kB9tBoGQjvq52m4woyv/gXWgQl8mS/naY33w4QA3XAQnO0WIoKBq6Et0/wVmpOByJpQGGFS6gvs5QmK+NlV012CAPskwPixuot5np8uJqjXAw1ynGQ1OGh+DvURBD2o+++ij0NLKLWCFacg= file: - - output/cf-mysql-plugin-linux-amd64.zip - - output/cf-mysql-plugin-linux-386.zip - - output/cf-mysql-plugin-darwin-amd64.zip - - output/cf-mysql-plugin-windows-amd64.zip - - output/cf-mysql-plugin-windows-386.zip + - output/cf-mysql-plugin-linux-amd64 + - output/cf-mysql-plugin-linux-386 + - output/cf-mysql-plugin-darwin-amd64 + - output/cf-mysql-plugin-amd64.exe + - output/cf-mysql-plugin-386.exe on: tags: true diff --git a/build_all.sh b/build_all.sh index a644e31..bc5602f 100755 --- a/build_all.sh +++ b/build_all.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail BINARY="cf-mysql-plugin" @@ -13,23 +14,26 @@ main() { 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" - destination="output/$platform-$arch" - binary=`binary_for_platform "$platform"` - mkdir -p "$destination" + + 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 "$binary" "$destination" + mv "$build_filename" "$release_name" - pushd "$destination" > /dev/null - zip ../"$BINARY-$platform-$arch.zip" * - popd > /dev/null + hash_val=`shasum ${release_name} | cut -f 1 -d" "` + hash_var_name="hash_${platform}_${arch}" + eval "$hash_var_name=${hash_val}" } -binary_for_platform() { +build_filename_for_platform() { platform="$1" case "$platform" in windows) @@ -41,5 +45,53 @@ binary_for_platform() { 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 <