1
0
mirror of https://github.com/rancher/cli.git synced 2026-02-06 21:48:05 +01:00
Files
cli/scripts/build
Enrico Candino ffe40feadf [v2.8][backport] Migrate from Drone to Github Actions, remove Dapper and add Darwin/arm64 support (#366)
* backport of #362

* avoid recursive find and inclusion of sha256sum.txt file in shasum

* added contents write permission to publish assets in release

* added comment
2024-05-23 17:37:16 +02:00

32 lines
883 B
Bash
Executable File

#!/bin/bash -e
source $(dirname $0)/version
cd $(dirname $0)/..
declare -A OS_ARCH_ARG
OS_PLATFORM_ARG=(linux windows darwin)
OS_ARCH_ARG[linux]="amd64 arm s390x"
OS_ARCH_ARG[windows]="386 amd64"
OS_ARCH_ARG[darwin]="amd64 arm64"
CGO_ENABLED=0 go build -ldflags="-w -s -X main.VERSION=$VERSION -extldflags -static" -o bin/rancher
if [ -n "$CROSS" ]; then
rm -rf build/bin
mkdir -p build/bin
for OS in ${OS_PLATFORM_ARG[@]}; do
for ARCH in ${OS_ARCH_ARG[${OS}]}; do
OUTPUT_BIN="build/bin/rancher_$OS-$ARCH"
if test "$OS" = "windows"; then
OUTPUT_BIN="${OUTPUT_BIN}.exe"
fi
echo "Building binary for $OS/$ARCH..."
GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 go build \
-ldflags="-w -X main.VERSION=$VERSION" \
-o ${OUTPUT_BIN} ./
done
done
fi