From 1b0b10d7c4f0e15ff494e4d90f66a722ccab8fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Travostino?= Date: Wed, 12 Oct 2022 12:02:39 +0100 Subject: [PATCH] build: Create tarball with vendored sources. Fixes #14 --- .gitignore | 1 + build.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b04c674..8397a13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ host-spawn build +vendor/ diff --git a/build.sh b/build.sh index 0dd9c0c..d168f71 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -euo pipefail + ARCH=" 386-i386 386-i686 @@ -8,12 +10,22 @@ ARCH=" arm64-aarch64 " +ROOT_DIR=$(dirname "$0") +VERSION=${VERSION:-HEAD} + +cd "$ROOT_DIR" + mkdir -p build -echo $VERSION +echo "$VERSION" for architecture in ${ARCH}; do CGO_ENABLED=0 GOARCH="$(echo "${architecture}" | cut -d'-' -f1)" go build \ -ldflags "-X main.Version=$VERSION" \ -o build/host-spawn-"$(echo "${architecture}" | cut -d'-' -f2)" done + +# Create source tarball including vendored dependencies +git clean -fdx -e build +go mod vendor +tar --create --zst --exclude build --file build/host-spawn-vendor.tar.zst "$ROOT_DIR"