From 0cb8bf900ba4095b531d85eb199e8ee02a649aa8 Mon Sep 17 00:00:00 2001 From: John Aylward Date: Wed, 4 Mar 2020 13:19:52 -0500 Subject: [PATCH] Ensure explicit ARM version and add FreeBSD builds --- .gitignore | 2 +- ci-build-script.sh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 42ce9ef..080f573 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ digitalocean-dynamic-ip.json # GoLand IDE .idea/ -releases \ No newline at end of file +releases diff --git a/ci-build-script.sh b/ci-build-script.sh index 760b593..224b183 100755 --- a/ci-build-script.sh +++ b/ci-build-script.sh @@ -6,18 +6,28 @@ if [[ -z "$package" ]]; then fi package_split=(${package//\// }) package_name=${package_split[-1]} -platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/386" "linux/amd64" "linux/arm" "linux/arm64") -mkdir releases +#see https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications for RPi arm versions +#see https://github.com/golang/go/wiki/GoArm +platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/386" "linux/amd64" "linux/arm/6" "linux/arm/7" "linux/arm64/8" "freebsd/386" "freebsd/amd64") +mkdir -p releases for platform in "${platforms[@]}" do platform_split=(${platform//\// }) GOOS=${platform_split[0]} GOARCH=${platform_split[1]} + GOARM=${platform_split[2]} output_name='digitalocean-dynamic-dns-ip-'$GOOS'-'$GOARCH + if [[ ! -z "$GOARM" ]]; then + output_name+="v${GOARM}" + # arm v8 is only supported for ARCH=arm64 and requires an empty GOARM version + if [[ "8" -eq "$GOARM" ]]; then + GOARM="" + fi + fi if [ $GOOS = "windows" ]; then output_name+='.exe' fi - env GOOS=$GOOS GOARCH=$GOARCH go build -o releases/$output_name $package_name + env GOOS="$GOOS" GOARCH="$GOARCH" GOARM="$GOARM" go build -o "releases/$output_name" "$package_name" if [ $? -ne 0 ]; then echo 'An error has occurred! Aborting the script execution...' exit 1