#!/usr/bin/env bash # Author: Guoliang Chen, a Senior Digital Design Engineer # Reduce a built dist/ directory to the assets a release publishes. # # Usage: tools/prune_release_assets.sh # tools/prune_release_assets.sh dist 0.10.0 # # A release page carries the seven .vsix packages and SHA256SUMS, nothing else # (docs/features/ci-release): the extension is the product, and the loose # per-triple binaries exist only so the packages can be built and audited from # them. Every package is checked by name first -- tools/release.sh would have # failed earlier, but a release quietly missing a platform is exactly the # failure this step exists to prevent -- then SHA256SUMS is *filtered* down to # its .vsix lines rather than recomputed, so the hashes published are the ones # tools/audit_artifacts.sh already gated on, everything else is deleted, and # what remains is re-verified the way a downloader would. # # Exit status: 0 if all seven packages were present and verified. set -eu [ $# -eq 2 ] || { echo "usage: $0 " >&2; exit 2; } dist=$1 version=$2 [ -d "$dist" ] || { echo "no dist directory at $dist" >&2; exit 2; } [ -f "$dist/SHA256SUMS" ] || { echo "no SHA256SUMS in $dist" >&2; exit 2; } cd "$dist" # The universal fallback, the five platform packages, and the all-platforms one. # Each is a must: a missing platform package strands that platform's users on # "install a binary yourself", which is the whole thing these packages fix. for suffix in "" -darwin-arm64 -darwin-x64 -linux-x64 -linux-arm64 -win32-x64 -all; do [ -f "lucisv-$version$suffix.vsix" ] || { echo "missing lucisv-$version$suffix.vsix" >&2 exit 1 } done grep '\.vsix$' SHA256SUMS > SHA256SUMS.tmp mv SHA256SUMS.tmp SHA256SUMS find . -type f ! -name '*.vsix' ! -name SHA256SUMS -delete shasum -a 256 -c SHA256SUMS # Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com