-
Notifications
You must be signed in to change notification settings - Fork 17
/
build_releases
executable file
·56 lines (42 loc) · 1.12 KB
/
build_releases
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -eu
NAME="ignition"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${NAME}"
GLDFLAGS=${GLDFLAGS:-}
if [ -z ${VERSION+a} ]; then
echo "Using version from git..."
VERSION=$(git describe --dirty --always)
fi
GLDFLAGS+="-X github.com/coreos/ignition/internal/version.Raw=${VERSION}"
if [[ -n "$(git status -s)" ]]; then
echo "git repo not clean"
exit 1
fi
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
eval $(go env)
if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=${PWD}/bin/releases/
fi
export GOPATH=${PWD}/gopath
export CGO_ENABLED=0
build_release() {
export NAME="ignition-validate-${1}"
echo "building ${NAME}"
go build -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${NAME} ${REPO_PATH}/validate
}
export GOOS=linux
export GOARCH=amd64
build_release x86_64-unknown-linux-gnu
export GOOS=darwin
export GOARCH=amd64
build_release x86_64-apple-darwin
export GOOS=windows
export GOARCH=amd64
build_release x86_64-pc-windows-gnu.exe
export GOOS=linux
export GOARCH=arm64
build_release aarch64-unknown-linux-gnu