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

Commit 8e9234e

Browse files
committed
Distribute windows artifact as coder.exe in a .zip
1 parent 0f0160a commit 8e9234e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

ci/steps/build.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
#!/bin/bash
22

33
# Make pushd and popd silent
4-
pushd () { builtin pushd "$@" > /dev/null ; }
5-
popd () { builtin popd > /dev/null ; }
4+
pushd() { builtin pushd "$@" >/dev/null; }
5+
popd() { builtin popd >/dev/null; }
66

77
set -euo pipefail
88
cd "$(dirname "$0")"
99

1010
export GOARCH=amd64
1111
tag=$(git describe --tags)
1212

13-
build(){
13+
build() {
1414
tmpdir=$(mktemp -d)
1515
go build -ldflags "-X main.version=${tag}" -o "$tmpdir/coder" ../../cmd/coder
1616

1717
pushd "$tmpdir"
18-
tarname="coder-cli-$GOOS-$GOARCH.tar.gz"
19-
tar -czf "$tarname" coder
18+
if [[ "$GOOS" == "windows" ]]; then
19+
artifact="coder-cli-$GOOS-$GOARCH.zip"
20+
mv coder coder.exe
21+
zip "$artifact" coder.exe
22+
else
23+
artifact="coder-cli-$GOOS-$GOARCH.tar.gz"
24+
tar -czf "$artifact" coder
25+
fi
2026
popd
2127

22-
mkdir -p ../bin
23-
cp "$tmpdir/$tarname" ../bin/$tarname
28+
mkdir -p ../bin
29+
cp "$tmpdir/$artifact" ../bin/$artifact
2430
rm -rf "$tmpdir"
2531
}
2632

0 commit comments

Comments
 (0)