diff --git a/.gitignore b/.gitignore index e43b0f9..e27209c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +bin/ \ No newline at end of file diff --git a/cross-compile.sh b/cross-compile.sh new file mode 100755 index 0000000..9e91eb8 --- /dev/null +++ b/cross-compile.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +TARGETS="linux/386 linux/amd64 linux/arm linux/arm64 windows/386 windows/amd64 windows/arm windows/arm64 darwin/amd64 darwin/arm64" + +rm -rf ./bin +for target in $TARGETS; do + GOOS=${target%/*} + GOARCH=${target#*/} + echo "Building for $GOOS/$GOARCH" + GOOS=$GOOS GOARCH=$GOARCH go build -o "bin/$GOOS-$GOARCH/" + ( + cd bin/$GOOS-$GOARCH/ + zip -r "../$GOOS-$GOARCH.zip" . + ) + rm -rf "bin/$GOOS-$GOARCH/" +done \ No newline at end of file