#!/bin/sh # VERSION and openapi.json's info.version must agree. # # They drifted once and 0.10.0 was published with the docs claiming 0.9.2. # openapi.json SHIPS IN THE SERVER PACKAGE and is served at /openapi.json, so a # stale value is live and misleading - and because a published version number is # never reused for different content, correcting it costs a whole release. # # A release step that depends on remembering is a release step that gets # skipped, so this is a check rather than a line in a checklist. set -eu cd "$(dirname "$0")/.." file_version="$(tr -d ' \t\n' < VERSION)" api_version="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' api/openapi.json | head -1)" if [ "$file_version" != "$api_version" ]; then echo "VERSION is '$file_version' but api/openapi.json info.version is '$api_version'" >&2 echo "Update api/openapi.json before releasing." >&2 exit 1 fi echo "version sync OK ($file_version)"