forked from coreos/ignition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_releases
executable file
·50 lines (38 loc) · 1 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
#!/usr/bin/env bash
set -eu
NAME="ignition"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${NAME}/v2"
GLDFLAGS=${GLDFLAGS:-}
if [ -z ${VERSION+a} ]; then
echo "Using version from git..."
VERSION=$(git describe --dirty --always)
fi
GLDFLAGS+="-X github.com/coreos/ignition/v2/internal/version.Raw=${VERSION}"
if [[ -n "$(git status -s)" ]]; then
echo "git repo not clean"
exit 1
fi
if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=${PWD}/bin/releases/
fi
export GO11MODULE=on
export CGO_ENABLED=0
export GOFLAGS='-mod=vendor'
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