check-version-sync.sh 952 B

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