37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -ne 2 ]; then
|
|
echo "usage: scripts/release/package-unix.sh <target-triple> <binary-path>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
target_triple="$1"
|
|
binary_path="$2"
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
version="$(node "$repo_root/scripts/release/version.mjs")"
|
|
artifact_basename="dbtool-$version-$target_triple"
|
|
artifact_dir="$repo_root/dist/$artifact_basename"
|
|
archive_path="$repo_root/dist/$artifact_basename.tar.gz"
|
|
checksum_path="$archive_path.sha256"
|
|
|
|
mkdir -p "$repo_root/dist"
|
|
rm -rf "$artifact_dir"
|
|
mkdir -p "$artifact_dir"
|
|
|
|
cp "$binary_path" "$artifact_dir/dbtool"
|
|
cp "$repo_root/README.md" "$artifact_dir/README.md"
|
|
cp "$repo_root/RELEASE_RUNBOOK.md" "$artifact_dir/RELEASE_RUNBOOK.md"
|
|
cp "$repo_root/SMOKE_RUNBOOK.md" "$artifact_dir/SMOKE_RUNBOOK.md"
|
|
|
|
tar -czf "$archive_path" -C "$repo_root/dist" "$artifact_basename"
|
|
|
|
(
|
|
cd "$repo_root/dist"
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
sha256sum "$(basename "$archive_path")" > "$(basename "$checksum_path")"
|
|
else
|
|
shasum -a 256 "$(basename "$archive_path")" > "$(basename "$checksum_path")"
|
|
fi
|
|
)
|