Skip to content

Commit 0116f7d

Browse files
committed
build: add release build script
1 parent 19d73d2 commit 0116f7d

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

scripts/build-release.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
VERSION=$(git describe --tags --exact-match)
6+
COMMIT=$(git rev-parse --short HEAD)
7+
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
8+
9+
mkdir -p dist
10+
11+
echo "Building ${VERSION}"
12+
13+
GOOS=linux GOARCH=amd64 \
14+
go build \
15+
-ldflags="-s -w \
16+
-X 'github.com/aasixh/devgrep/cmd.Version=${VERSION}' \
17+
-X 'github.com/aasixh/devgrep/cmd.Commit=${COMMIT}' \
18+
-X 'github.com/aasixh/devgrep/cmd.Date=${DATE}'" \
19+
-o dist/devgrep-linux-amd64 .
20+
21+
GOOS=windows GOARCH=amd64 \
22+
go build \
23+
-ldflags="-s -w \
24+
-X 'github.com/aasixh/devgrep/cmd.Version=${VERSION}' \
25+
-X 'github.com/aasixh/devgrep/cmd.Commit=${COMMIT}' \
26+
-X 'github.com/aasixh/devgrep/cmd.Date=${DATE}'" \
27+
-o dist/devgrep-windows-amd64.exe .
28+
29+
GOOS=darwin GOARCH=amd64 \
30+
go build \
31+
-ldflags="-s -w \
32+
-X 'github.com/aasixh/devgrep/cmd.Version=${VERSION}' \
33+
-X 'github.com/aasixh/devgrep/cmd.Commit=${COMMIT}' \
34+
-X 'github.com/aasixh/devgrep/cmd.Date=${DATE}'" \
35+
-o dist/devgrep-darwin-amd64 .
36+
37+
GOOS=darwin GOARCH=arm64 \
38+
go build \
39+
-ldflags="-s -w \
40+
-X 'github.com/aasixh/devgrep/cmd.Version=${VERSION}' \
41+
-X 'github.com/aasixh/devgrep/cmd.Commit=${COMMIT}' \
42+
-X 'github.com/aasixh/devgrep/cmd.Date=${DATE}'" \
43+
-o dist/devgrep-darwin-arm64 .
44+
45+
echo "Done."

0 commit comments

Comments
 (0)