-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
40 lines (29 loc) · 918 Bytes
/
build.sh
File metadata and controls
40 lines (29 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
VERSION=$(grep -r "const Version = " internal/version/version.go | cut -d'"' -f2)
echo "Downloading dependencies..."
go mod tidy
mkdir -p build
build() {
local GOOS=$1
local GOARCH=$2
local SUFFIX=$3
echo "Building for $GOOS/$GOARCH..."
local BINARY="wago"
if [ ! -z "$SUFFIX" ]; then
BINARY="${BINARY}${SUFFIX}"
fi
GOOS=$GOOS GOARCH=$GOARCH go build -o "build/${BINARY}-${GOOS}-${GOARCH}${SUFFIX}" -ldflags "-X main.Version=${VERSION}"
}
echo "Cleaning build directory..."
rm -rf build/*
build "linux" "amd64" "" # Linux AMD64
build "linux" "arm64" "" # Linux ARM64
build "darwin" "amd64" "" # macOS AMD64
build "darwin" "arm64" "" # macOS ARM64
echo "Generating checksums..."
cd build
shasum -a 256 * > checksums.txt
cd ..
echo "Build complete! Binaries are in the build directory:"
ls -lh build/