goshorly/build-ci.sh

21 lines
961 B
Bash
Raw Normal View History

2021-12-08 10:04:28 +00:00
export I_PACKAGE="git.ucode.space/Phil/goshorly/utils"
export I_GitCommitShort=$(git rev-parse --short HEAD)
export I_GitBranch=$(git rev-parse --abbrev-ref HEAD)
go mod download
case $1 in
"linux")
2021-12-08 10:13:56 +00:00
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-linux-amd64 .
2021-12-08 10:04:28 +00:00
;;
"windows")
2021-12-08 10:13:56 +00:00
CGO_ENABLED=0 GOOS=windows go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-windows-amd64 .
2021-12-08 10:04:28 +00:00
;;
"darwin")
2021-12-08 10:13:56 +00:00
CGO_ENABLED=0 GOOS=darwin go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-darwin-amd64 .
2021-12-08 10:04:28 +00:00
;;
*)
2021-12-08 10:13:56 +00:00
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app .
2021-12-08 10:04:28 +00:00
;;
esac