Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Add build script and prepare for new release
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislas Lange <[email protected]>
  • Loading branch information
angristan committed May 26, 2020
1 parent 02356c6 commit 3799715
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .goxc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
41 changes: 41 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit 3799715

Please sign in to comment.