diff --git a/.goxc.json b/.goxc.json index 2ee38d1..b1f3ab7 100644 --- a/.goxc.json +++ b/.goxc.json @@ -17,7 +17,7 @@ "BuildConstraints": "darwin linux windows freebsd", "ResourcesExclude": "*.go .goxc-temp", "MainDirsExclude": "vendor,Godeps,testdata", - "PackageVersion": "0.0.1", + "PackageVersion": "v0.4.0", "TaskSettings": { "publish-github": { "owner": "scaleway", diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d08304b --- /dev/null +++ b/build.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +mkdir -p dist/ +rm -rf dist/* + +package="github.com/scaleway/c14-cli/cmd/c14" +package_name="c14" + +platforms=( + "windows/amd64" + "windows/386" + "darwin/amd64" + "darwin/386" + "linux/amd64" + "linux/386" + "linux/arm" + "linux/arm64" + "freebsd/amd64" + "freebsd/386" + "freebsd/arm" + ) + +for platform in "${platforms[@]}" +do + platform_split=(${platform//\// }) + GOOS=${platform_split[0]} + GOARCH=${platform_split[1]} + output_name=$package_name'-'$GOOS'-'$GOARCH + if [ $GOOS = "windows" ]; then + output_name+='.exe' + fi + + echo "Building for $platform... (dist/$output_name)" + env GOOS=$GOOS GOARCH=$GOARCH go build -o dist/$output_name $package + if [ $? -ne 0 ]; then + echo 'An error has occurred! Aborting the script execution...' + exit 1 + fi +done + +echo "Done."