From 15024406c2964e3a7da5d7aff69d3e73c61e7392 Mon Sep 17 00:00:00 2001 From: yechentide Date: Mon, 16 Oct 2023 22:09:47 +0900 Subject: [PATCH] feat: add a script to build binary files for Linux/macOS/Windows --- build.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..849cfaf --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -eu + +BINARY_NAME=mhnow-bot +BUILD_DIR=./build +declare -r BINARY_NAME +declare -r BUILD_DIR + +if [[ ! -e "${BUILD_DIR}" ]]; then + mkdir -p "${BUILD_DIR}" +fi + +GOOS=linux GOARCH=amd64 go build -o "${BUILD_DIR}/${BINARY_NAME}_linux_x86_64" ./main.go +GOOS=linux GOARCH=arm64 go build -o "${BUILD_DIR}/${BINARY_NAME}_linux_arm64" ./main.go +GOOS=windows GOARCH=amd64 go build -o "${BUILD_DIR}/${BINARY_NAME}_windows_x86_64.exe" ./main.go +GOOS=darwin GOARCH=arm64 go build -o "${BUILD_DIR}/${BINARY_NAME}_macos_arm64" ./main.go