#!/bin/sh set -eu fail() { printf '%s\n' "check-release-source: $*" >&2; exit 1; } [ "$#" -eq 1 ] || fail "usage: $0 vMAJOR.MINOR.PATCH" version=$1 printf '%s\n' "$version" | grep -E -x 'v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)' >/dev/null || fail "invalid stable release version" script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd) cd "$script_dir/.." note="docs/releases/$version.md" [ -s "$note" ] || fail "missing release note: $note" [ "$(head -n 1 "$note")" = "# Notarius $version" ] || fail "release note title does not match version" export GOWORK=off go test -count=1 ./... # Exercise the actual command and its linker-supplied diagnostic version. verification_dir=$(mktemp -d "${TMPDIR:-/tmp}/notarius-release-check.XXXXXX") trap 'rm -rf "$verification_dir"' 0 HUP INT TERM go build -trimpath -ldflags "-X gitea.maximumdirect.net/eric/notarius/internal/buildinfo.Override=$version" \ -o "$verification_dir/notarius" ./cmd/notarius [ "$("$verification_dir/notarius" --version)" = "notarius $version" ] || fail "incorrect diagnostic version"