d2/ci/release/_build.sh

24 lines
714 B
Bash
Raw Normal View History

2022-11-13 03:10:45 +00:00
#!/bin/sh
set -eu
cd -- "$(dirname "$0")/../.."
. ./ci/sub/lib.sh
sh_c mkdir -p "$HW_BUILD_DIR"
sh_c rsync --recursive --perms --delete \
--human-readable --copy-links ./ci/release/template/ "$HW_BUILD_DIR/"
VERSION=$VERSION sh_c eval "'$HW_BUILD_DIR/README.md.sh'" \> "'$HW_BUILD_DIR/README.md'"
sh_c rm -f "$HW_BUILD_DIR/README.md.sh"
2022-11-14 05:58:55 +00:00
sh_c find "$HW_BUILD_DIR" -exec touch {} \\\;
2022-11-13 03:10:45 +00:00
ensure_goos
ensure_goarch
2022-11-13 03:10:45 +00:00
sh_c mkdir -p "$HW_BUILD_DIR/bin"
sh_c CGO_ENABLED=0 go build -trimpath \
-ldflags "'-X oss.terrastruct.com/d2/lib/version.Version=$VERSION'" \
2022-12-01 05:14:38 +00:00
-o "$HW_BUILD_DIR/bin/d2" .
2022-11-13 03:10:45 +00:00
2022-11-14 10:13:37 +00:00
ARCHIVE=$PWD/$ARCHIVE
cd "$(dirname "$HW_BUILD_DIR")"
sh_c tar -czf "$ARCHIVE" "$(basename "$HW_BUILD_DIR")"
cd ->/dev/null