Files
dify/cli/scripts/release-write-checksums.sh
Yunlu Wen a728e0ac69 feat: adding dify cli (#36348)
Co-authored-by: GareArc <garethcxy@dify.ai>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: L1nSn0w <l1nsn0w@qq.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: gigglewang <gigglewang@dify.ai>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
2026-05-26 01:12:36 +00:00

39 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# scripts/release-write-checksums.sh — write sha256 manifest for release binaries.
#
# Required env: CLI_VERSION (e.g. 0.1.0-rc.1). Output:
# cli/dist/bin/difyctl-v<CLI_VERSION>-checksums.txt
set -euo pipefail
_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/common.sh
source "${_dir}/lib/common.sh"
: "${CLI_VERSION:?CLI_VERSION is required}"
cd "$(cli::root)/dist/bin"
manifest="difyctl-v${CLI_VERSION}-checksums.txt"
> "$manifest"
if command -v sha256sum >/dev/null 2>&1; then
hash_cmd="sha256sum"
elif command -v shasum >/dev/null 2>&1; then
hash_cmd="shasum -a 256"
else
die "no sha256 hasher found (need sha256sum or shasum)"
fi
found=0
for bin in difyctl-v"${CLI_VERSION}"-*; do
[[ -f "$bin" ]] || continue
[[ "$bin" == "$manifest" ]] && continue
$hash_cmd "$bin" >> "$manifest"
found=$((found + 1))
done
[[ "$found" -gt 0 ]] || die "no binaries matching difyctl-v${CLI_VERSION}-* in dist/bin/"
log::info "wrote ${manifest} (${found} entries)"