forked from micromdm/micromdm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·31 lines (27 loc) · 1.01 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
VERSION="$(git describe --tags --always --dirty)"
USER=$(whoami)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
REVISION=$(git rev-parse HEAD)
GOVERSION=$(go version | awk '{print $3}')
mkdir -p build
build() {
echo -n "=> $1-$2: "
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -o build/$NAME-$1-$2 -ldflags "\
-X github.com/micromdm/micromdm/version.version=${VERSION}\
-X github.com/micromdm/micromdm/version.branch=${BRANCH}\
-X github.com/micromdm/micromdm/version.buildUser=${USER}\
-X github.com/micromdm/micromdm/version.buildDate=${NOW}\
-X github.com/micromdm/micromdm/version.revision=${REVISION}\
-X github.com/micromdm/micromdm/version.goVersion=${GOVERSION}\
" $3
du -h build/$NAME-$1-$2
}
NAME=micromdm
echo "Building $NAME version $VERSION"
build "darwin" "amd64" "./*.go"
build "linux" "amd64" "./*.go"
NAME=mdmctl
echo "\nBuilding $NAME version $VERSION"
build "darwin" "amd64" "./cmd/mdmctl/*.go"
build "linux" "amd64" "./cmd/mdmctl/*.go"