Files
lucisv/tools/release.sh
T
lucioandClaude Fable 5 26a59c1d6a Add release-prep: vfmt 0.2.0, LICENSE, CHANGELOG, release tooling
Version bumped to 0.2.0 (workspace-inherited, one line + lockfiles;
both binaries report it). Root MIT LICENSE plus the editors/vscode
copy that lets vsce package run without --skip-license, closing the
editor-packaging handshake. CHANGELOG.md is a user-facing first-
release document: six area paragraphs linking the feature READMEs,
stating the current corpus truth (476/820 formattable, zero
verification errors, zero crashes). tools/release.sh builds
checksummed host binaries + the sideloadable .vsix into gitignored
dist/ (aborts before deleting prior artifacts on failure -- proven
live); tools/RELEASING.md is the checklist, with marketplace/OpenVSX
commands demoted to an explicitly optional appendix per the owner:
publishing is fully deferred, sideloading via code
--install-extension is the supported path, publisher stays
REPLACE-ME.

Dev: Opus agent (mid-flight scope trim handled cleanly); QA: Sonnet
agent (artifacts, real sideload cycle, all 26 changelog links);
review in docs/features/release-prep/README.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-19 12:39:10 -07:00

91 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build vfmt's release artifacts into dist/ and checksum them.
#
# Produces, for the machine it runs on:
# dist/vfmt-<version>-<host-triple>
# dist/vfmt-server-<version>-<host-triple>
# dist/vfmt-<version>.vsix (the VS Code extension; sideload it)
# dist/SHA256SUMS
#
# Standard tooling only -- cargo, npm and shasum, nothing installed globally.
# This does not cross-compile and does not publish anything anywhere; see
# tools/RELEASING.md for the whole checklist.
#
# Usage: tools/release.sh [-o dist-dir] [--no-vsix]
#
# Exit status: 0 if every requested artifact was built and checksummed.
set -eu
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
dist=$repo_root/dist
want_vsix=1
while [ $# -gt 0 ]; do
case $1 in
-o) dist=$2; shift 2 ;;
--no-vsix) want_vsix=0; shift ;;
*) echo "usage: $0 [-o dist-dir] [--no-vsix]" >&2; exit 2 ;;
esac
done
case $dist in
/*) ;;
*) dist=$repo_root/$dist ;;
esac
echo "==> building release binaries"
cargo build --release --manifest-path "$repo_root/Cargo.toml" \
-p vfmt -p vfmt_server
# The binaries themselves are the authority on the version, not Cargo.toml:
# `vfmt --version` is what a user will quote in a bug report.
version=$("$repo_root/target/release/vfmt" --version | awk '{print $2}')
host=$(rustc -vV | awk '/^host:/{print $2}')
echo " vfmt $version, host $host"
rm -rf "$dist"
mkdir -p "$dist"
cp "$repo_root/target/release/vfmt" "$dist/vfmt-$version-$host"
cp "$repo_root/target/release/vfmt-server" "$dist/vfmt-server-$version-$host"
# Prove the server binary still speaks LSP before it is handed to anyone.
# `smoke.js` is plain node with no dependencies, so this runs before `npm ci`.
if command -v node >/dev/null 2>&1; then
echo "==> smoke-testing the server binary"
node "$repo_root/editors/vscode/smoke.js" "$dist/vfmt-server-$version-$host"
else
echo " note: no node on PATH, skipping the server smoke test" >&2
fi
if [ "$want_vsix" -eq 1 ]; then
echo "==> packaging the VS Code extension"
# `vsce` shells out to `npm list` and globs the paths it prints back, so it
# must run from a plain path: under a directory whose name has the shape the
# session sandbox rewrites, it silently collects zero files and fails with
# "Extension entrypoint(s) missing". The repo itself is such a plain path,
# which is why this packages in place and only the output goes to -o.
(
cd "$repo_root/editors/vscode"
npm ci
npx @vscode/vsce package --out "$dist/vfmt-$version.vsix"
)
fi
echo "==> checksums"
artifacts="vfmt-$version-$host vfmt-server-$version-$host"
if [ "$want_vsix" -eq 1 ]; then
artifacts="$artifacts vfmt-$version.vsix"
fi
(
# Relative names, so `shasum -c SHA256SUMS` works from inside dist/.
cd "$dist"
# shellcheck disable=SC2086 # deliberate word splitting: one name per file
shasum -a 256 $artifacts > SHA256SUMS
cat SHA256SUMS
)
echo
echo "artifacts in $dist:"
ls -l "$dist"