-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·21 lines (15 loc) · 1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
go version || exit 1
commitId=$(git log --format="%H" -n 1)
sed -i "s|var gitCommit string = \"###GitCommitPlaceholder###\"|var gitCommit string = \"${commitId}\"|g" internal/config/config.go
# Linux
echo "Building for Linux OS with AMD64 Arch"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8senv-linux-amd64 main.go && echo "✅ DONE" || echo "❌ FAILED"
echo "Building for Linux OS with ARM64 Arch"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o k8senv-linux-arm64 main.go && echo "✅ DONE" || echo "❌ FAILED"
sed -i "s|var gitCommit string = \"${commitId}\"|var gitCommit string = \"###GitCommitPlaceholder###\"|g" internal/config/config.go
# macOS
# echo "Building for MacOS with AMD64 Arch"
# CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o k8senv-macos-x86_64 main.go && echo "✅ DONE" || echo "❌ FAILED"
# echo "Building for MacOS with ARM64 Arch"
# CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o k8senv-macos-arm64 main.go && echo "✅ DONE" || echo "❌ FAILED"