mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
Brings seaweed-block main (v1.1.1 plus the docs and a test fix after it) into seaweed-block/ as one commit. Only files under seaweed-block/ change, and the subtree equals seaweed-block main exactly. The module's full history stays in the seaweed-block repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
2.1 KiB
Bash
50 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Copy release executables unchanged from the exact published Linux image.
|
|
set -euo pipefail
|
|
[ "$#" = 4 ] || { echo "usage: release-binary-assets.sh IMAGE@DIGEST REVISION TAG OUT" >&2; exit 2; }
|
|
image=$1; revision=$2; tag=$3; out=$4
|
|
[[ "$image" =~ @sha256:[a-f0-9]{64}$ ]] || { echo "an immutable image digest is required" >&2; exit 2; }
|
|
[[ "$revision" =~ ^[a-f0-9]{40}$ ]] || { echo "a full Git revision is required" >&2; exit 2; }
|
|
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]] || { echo "invalid release tag" >&2; exit 2; }
|
|
work=$(mktemp -d)
|
|
container=
|
|
cleanup() {
|
|
local status=$? cleanup_status=0 next_status=0
|
|
trap - EXIT
|
|
if [ -n "$container" ]; then
|
|
docker rm "$container" >/dev/null || cleanup_status=$?
|
|
fi
|
|
rm -rf -- "${work:?}" || {
|
|
next_status=$?
|
|
if [ "$cleanup_status" = 0 ]; then cleanup_status=$next_status; fi
|
|
}
|
|
if [ "$status" = 0 ]; then status=$cleanup_status; fi
|
|
exit "$status"
|
|
}
|
|
trap cleanup EXIT
|
|
mkdir -p "$work/bin"
|
|
docker pull "$image"
|
|
container=$(docker create "$image")
|
|
for binary in blockmaster blockvolume sw-block; do
|
|
docker cp "$container:/usr/local/bin/$binary" "$work/bin/$binary"
|
|
version=$("$work/bin/$binary" -version)
|
|
if [ "$version" != "$binary revision=$revision modified=false" ]; then
|
|
echo "$binary revision mismatch: expected $revision modified=false, got $version" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
mkdir -p "$out"
|
|
asset="sw-block-${tag}-linux-amd64.tar.gz"
|
|
tar -C "$work/bin" -czf "$out/$asset" blockmaster blockvolume sw-block
|
|
(cd "$out" && sha256sum "$asset" >SHA256SUMS)
|
|
prerelease=false
|
|
if [[ "$tag" == *-* ]]; then prerelease=true; fi
|
|
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
|
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" --prerelease="$prerelease"
|
|
gh release upload "$tag" "$out/$asset" "$out/SHA256SUMS" --repo "$GITHUB_REPOSITORY" --clobber
|
|
else
|
|
args=(--repo "$GITHUB_REPOSITORY" --verify-tag --title "Seaweed Block $tag" --generate-notes)
|
|
args+=(--prerelease="$prerelease")
|
|
gh release create "$tag" "$out/$asset" "$out/SHA256SUMS" "${args[@]}"
|
|
fi
|