Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 04a201f

Browse files
authored
Merge pull request #126 from cdr/build-windows-on-linux
Build for windows when building on linux
2 parents ac39d3c + 6fdfbf2 commit 04a201f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ci/steps/build.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ popd() { builtin popd >/dev/null; }
77
set -euo pipefail
88
cd "$(dirname "$0")"
99

10-
export GOARCH=amd64
1110
tag=$(git describe --tags)
1211

1312
build() {
13+
echo "Building coder-cli for $GOOS-$GOARCH..."
14+
1415
tmpdir=$(mktemp -d)
1516
go build -ldflags "-X main.version=${tag}" -o "$tmpdir/coder" ../../cmd/coder
1617

@@ -33,12 +34,11 @@ build() {
3334
# Darwin builds do not work from Linux, so only try to build them from Darwin.
3435
# See: https://github.com/cdr/coder-cli/issues/20
3536
if [[ "$(uname)" == "Darwin" ]]; then
36-
GOOS=linux build
37-
CGO_ENABLED=1 GOOS=darwin build
38-
GOOS=windows GOARCH=386 build
39-
exit 0
37+
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 build
38+
else
39+
echo "Warning: Darwin builds don't work on Linux."
40+
echo "Please use an OSX machine to build Darwin tars."
4041
fi
4142

42-
echo "Warning: Darwin builds don't work on Linux."
43-
echo "Please use an OSX machine to build Darwin tars."
44-
GOOS=linux build
43+
GOOS=linux GOARCH=amd64 build
44+
GOOS=windows GOARCH=386 build

0 commit comments

Comments
 (0)