File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3-
3+ export CGO_ENABLED=0
44LDFLAGS=(
55 -w
66 -extldflags
@@ -10,20 +10,26 @@ LDFLAGS=(
1010 -X main.BuildDate=" $( date -u ' +%Y-%m-%dT%I:%M:%S%p' ) "
1111)
1212
13- export CGO_ENABLED=0
14-
13+ # If we are build from the dockerfile only build required binary
1514if [[ " ${BUILD_IN_DOCKER} " == " true" ]]; then
1615 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags " ${LDFLAGS[*]} " ./cmd/scw
17- else
18- SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
19- ROOT_DIR=" $( cd " $SCRIPT_DIR /.." && pwd) "
20- BIN_DIR=" $ROOT_DIR /bin"
16+ exit 0
17+ fi
18+
19+
20+ BIN_DIR=" ./bin"
21+ VERSION=$( go run cmd/scw/main.go -o json version | jq -r .version | tr . -)
22+ BIN_LINUX=" $BIN_DIR /scw-$VERSION -linux-x86_64"
23+ BIN_DARWIN=" $BIN_DIR /scw-$VERSION -darwin-x86_64"
24+ BIN_WINDOWS=" $BIN_DIR /scw-$VERSION -windows-x86_64.exe"
25+
26+ mkdir -p $BIN_DIR
27+ GOOS=linux GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_LINUX " cmd/scw/main.go
28+ GOOS=darwin GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_DARWIN " cmd/scw/main.go
29+ GOOS=windows GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_WINDOWS " cmd/scw/main.go
2130
22- mkdir -p $BIN_DIR
23-
24- VERSION=$( go run cmd/scw/main.go -o json version | jq -r .version | tr . -)
25-
26- GOOS=linux GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_DIR /scw-$VERSION -linux-x86_64" cmd/scw/main.go
27- GOOS=darwin GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_DIR /scw-$VERSION -darwin-x86_64" cmd/scw/main.go
28- GOOS=windows GOARCH=amd64 go build -ldflags " ${LDFLAGS[*]} " -o " $BIN_DIR /scw-$VERSION -windows-x86_64.exe" cmd/scw/main.go
29- fi
31+ shasum -a 256 \
32+ " $BIN_LINUX " \
33+ " $BIN_DARWIN " \
34+ " $BIN_WINDOWS " \
35+ | sed -e ' s#./bin/##' > " $BIN_DIR /SHA256SUMS"
You can’t perform that action at this time.
0 commit comments