Skip to content

Commit

Permalink
build: added a build script
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrbacbravo committed Mar 30, 2024
1 parent 6c47608 commit b1355c4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Name of your project
PROJECT_NAME="chatterbox-cli"

# Output name
OUTPUT_NAME="chatterbox"

# Go path
GO_PATH=$(which go)

# Platforms to build for
PLATFORMS=("darwin/amd64" "darwin/arm64" "windows/amd64" "linux/amd64")

# Build directory
BUILD_DIR="./bin"

# Create the build directory if it doesn't exist
mkdir -p $BUILD_DIR

# Build for all platforms
for platform in "${PLATFORMS[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}

output_name=$BUILD_DIR/$OUTPUT_NAME'-'$GOOS'-'$GOARCH

if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH $GO_PATH build -o $output_name $PROJECT_NAME

echo 'Built for '$platform
done

0 comments on commit b1355c4

Please sign in to comment.