Skip to content

Commit 39fe1bb

Browse files
author
gregorgololicic
committed
add cross platform build
1 parent 29245f2 commit 39fe1bb

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

build/cross-platofrm-build.bash

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
package=$1
4+
if [[ -z "$package" ]]; then
5+
echo "usage: $0 <package-name>"
6+
exit 1
7+
fi
8+
package_split=(${package//\// })
9+
package_name=${package_split[-1]}
10+
11+
platforms=("windows/amd64" "windows/386" "darwin/amd64")
12+
13+
for platform in "${platforms[@]}"
14+
do
15+
platform_split=(${platform//\// })
16+
GOOS=${platform_split[0]}
17+
GOARCH=${platform_split[1]}
18+
output_name=$package_name'-'$GOOS'-'$GOARCH
19+
if [ $GOOS = "windows" ]; then
20+
output_name+='.exe'
21+
fi
22+
23+
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name $package
24+
if [ $? -ne 0 ]; then
25+
echo 'An error has occurred! Aborting the script execution...'
26+
exit 1
27+
fi
28+
done

build/darwin-amd64-flow

21 MB
Binary file not shown.

build/linux-amd64-flow

21.1 MB
Binary file not shown.

build/windows-amd64-flow.exe

21.2 MB
Binary file not shown.

flow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func init() {
1616
func main() {
1717

1818
APIURL := viper.GetString("APIURL")
19-
version := "1.0"
19+
version := "1.0" // get from build
2020

2121
gateway := gateway.CreateGateway(models.GRPC, APIURL)
2222
rootCmd := cmd.NewCmdRoot(gateway, version)

0 commit comments

Comments
 (0)