File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ if [[ -z "$version" ]]; then
7
7
exit 1
8
8
fi
9
9
10
+ git_sha=` git rev-parse --short HEAD`
11
+ version_with_sha=" ${version} +${git_sha} "
12
+
10
13
if [ -d build ]; then
11
14
rm -rf build
12
15
fi
27
30
28
31
29
32
if [ $GOOS = " windows" ]; then
30
- env GOOS=$GOOS GOARCH=$GOARCH go build -o " build/${output_name} .exe" .
33
+ env GOOS=$GOOS GOARCH=$GOARCH go build -o " build/${output_name} .exe" -ldflags " -X main.Rev= ${version_with_sha} " .
31
34
else
32
- env GOOS=$GOOS GOARCH=$GOARCH go build -o " build/${output_name} " .
35
+ env GOOS=$GOOS GOARCH=$GOARCH go build -o " build/${output_name} " -ldflags " -X main.Rev= ${version_with_sha} " .
33
36
fi
34
37
if [ $? -ne 0 ]; then
35
38
echo " Building the binary has failed!"
38
41
39
42
printf " ==> Tarballing %s\t%s\n" " $platform " " build/${output_name} .tar.gz" | expand -t 30
40
43
if [ $GOOS = " windows" ]; then
41
- tar -czf " build/${output_name} .tar.gz" " build/ ${output_name} .exe"
44
+ tar -czf " build/${output_name} .tar.gz" -C " build" " ${output_name} .exe"
42
45
else
43
- tar -czf " build/${output_name} .tar.gz" " build/ ${output_name} "
46
+ tar -czf " build/${output_name} .tar.gz" -C " build" " ${output_name} "
44
47
fi
45
48
46
49
if [ $? -ne 0 ]; then
You can’t perform that action at this time.
0 commit comments