git.iko.soy/typeable/oauth2-proxy
on atlassian-provider help sign in
39 lines 1.2 kB history raw
1#!/usr/bin/env bash
3set -o errexit
5if [[ -z ${BINARY} ]] || [[ -z ${VERSION} ]]; then
6 echo "Missing required env var: BINARY=X VERSION=X $(basename $0)"
7 exit 1
8fi
10ARCHS=(darwin-amd64 linux-amd64 linux-arm64 linux-armv6 freebsd-amd64 windows-amd64)
12mkdir -p release
14# Create architecture specific release dirs
15for ARCH in "${ARCHS[@]}"; do
16 mkdir -p release/${BINARY}-${VERSION}.${ARCH}
18 GO_OS=$(echo $ARCH | awk -F- '{print $1}')
19 GO_ARCH=$(echo $ARCH | awk -F- '{print $2}')
21 # Create architecture specific binaries
22 if [[ ${GO_ARCH} == "armv6" ]]; then
23 GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags="-X main.VERSION=${VERSION}" \
24 -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
25 else
26 GO111MODULE=on GOOS=${GO_OS} GOARCH=${GO_ARCH} CGO_ENABLED=0 go build -ldflags="-X main.VERSION=${VERSION}" \
27 -o release/${BINARY}-${VERSION}.${ARCH}/${BINARY} .
28 fi
30 cd release
32 # Create sha256sum for architecture specific binary
33 sha256sum ${BINARY}-${VERSION}.${ARCH}/${BINARY} > ${BINARY}-${VERSION}.${ARCH}-sha256sum.txt
35 # Create tar file for architecture specific binary
36 tar -czvf ${BINARY}-${VERSION}.${ARCH}.tar.gz ${BINARY}-${VERSION}.${ARCH}
38 cd ..
39done