Skip to content

Commit

Permalink
add cross platform build
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorgololicic committed Jan 4, 2021
1 parent 29245f2 commit 39fe1bb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions build/cross-platofrm-build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

package=$1
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
package_split=(${package//\// })
package_name=${package_split[-1]}

platforms=("windows/amd64" "windows/386" "darwin/amd64")

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

env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name $package
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
Binary file added build/darwin-amd64-flow
Binary file not shown.
Binary file added build/linux-amd64-flow
Binary file not shown.
Binary file added build/windows-amd64-flow.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func init() {
func main() {

APIURL := viper.GetString("APIURL")
version := "1.0"
version := "1.0" // get from build

gateway := gateway.CreateGateway(models.GRPC, APIURL)
rootCmd := cmd.NewCmdRoot(gateway, version)
Expand Down

0 comments on commit 39fe1bb

Please sign in to comment.